1
+ package com.baeldung.math.octalconversion
2
+
3
+ import org.junit.jupiter.api.Assertions
4
+ import org.junit.jupiter.api.Test
5
+ import java.math.BigInteger
6
+
7
+ class OctalDecimalConverstionUnitTest {
8
+
9
+ @Test
10
+ fun `test octal to decimal conversion using octalToDecimalUsingParseInt should give correct result` () {
11
+ Assertions .assertEquals(28 , octalToDecimalUsingParseInt(" 34" ))
12
+ }
13
+
14
+ @Test
15
+ fun `test octal to decimal conversion using octalToDecimalUsingIteration should give correct result` () {
16
+ Assertions .assertEquals(28 , octalToDecimalUsingIteration(" 34" ))
17
+ }
18
+
19
+ @Test
20
+ fun `test octal to decimal conversion using octalToDecimal extension function should give correct result` () {
21
+ Assertions .assertEquals(28 , " 34" .octalToDecimal())
22
+ }
23
+
24
+ @Test
25
+ fun `test octal to decimal conversion using octalToDecimalUsingToInt should give correct result` () {
26
+ Assertions .assertEquals(28 , octalToDecimalUsingToInt(" 34" ))
27
+ }
28
+
29
+ @Test
30
+ fun `test octal to decimal conversion using octalToDecimalUsingBigInteger should give correct result` () {
31
+ Assertions .assertEquals(BigInteger .valueOf(28 ), octalToDecimalUsingBigInteger(" 34" ))
32
+ }
33
+
34
+ @Test
35
+ fun `test decimal to octal conversion using decimalToOctalUsingIntegerToString should give correct result` () {
36
+ Assertions .assertEquals(" 34" , decimalToOctalUsingIntegerToString(28 ))
37
+ }
38
+
39
+ @Test
40
+ fun `test decimal to octal conversion using decimalToOctalUsingStringInterpolation should give correct result` () {
41
+ Assertions .assertEquals(" 34" , decimalToOctalUsingStringInterpolation(28 ))
42
+ }
43
+
44
+ @Test
45
+ fun `test decimal to octal conversion using decimalToOctal extension function should give correct result` () {
46
+ Assertions .assertEquals(" 34" , 28 .decimalToOctal())
47
+ }
48
+
49
+ @Test
50
+ fun `test decimal to octal conversion using decimalToOctalUsingIteration should give correct result` () {
51
+ Assertions .assertEquals(" 34" , decimalToOctalUsingIteration(28 ))
52
+ }
53
+ }
0 commit comments