Pārlūkot izejas kodu

Merge branch 'master' of https://git.zipcode.rocks/woat/ZCW-BasicComputations-BlueJ

Ahmad Rusdi 6 gadus atpakaļ
vecāks
revīzija
fa328fecd2

Binārs
.DS_Store Parādīt failu


+ 12
- 0
Factorial.java Parādīt failu

@@ -0,0 +1,12 @@
1
+ 
2
+
3
+
4
+import java.math.BigInteger;
5
+
6
+public class Factorial {
7
+
8
+    public BigInteger factorialOf(Integer value){
9
+        return null;
10
+    }
11
+
12
+}

+ 30
- 0
FactorialTest.java Parādīt failu

@@ -0,0 +1,30 @@
1
+ 
2
+
3
+
4
+import org.junit.Assert;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+import java.math.BigInteger;
9
+
10
+public class FactorialTest {
11
+
12
+    private Factorial factorial;
13
+
14
+    @Before
15
+    public void setUp(){
16
+        factorial = new Factorial();
17
+    }
18
+
19
+    @Test
20
+    public void factorialOfTest(){
21
+        //:Given
22
+        BigInteger expected = new BigInteger("24");
23
+
24
+        //:When
25
+        BigInteger actual = factorial.factorialOf(4);
26
+
27
+        //:Then
28
+        Assert.assertEquals("Values should be equal", expected, actual);
29
+    }
30
+}

+ 21
- 0
IntegerPrinter.java Parādīt failu

@@ -0,0 +1,21 @@
1
+ 
2
+
3
+
4
+public class IntegerPrinter {
5
+
6
+    public String printIntegerAsBinary(int value){
7
+        return null;
8
+    }
9
+
10
+    public String printIntegerAsOctal(int value){
11
+        return null;
12
+    }
13
+
14
+    public String printIntegerAsHexadecimal(int value){
15
+        return null;
16
+    }
17
+
18
+    public static void main(String[] args){
19
+
20
+    }
21
+}

+ 53
- 0
IntegerPrinterTest.java Parādīt failu

@@ -0,0 +1,53 @@
1
+ 
2
+
3
+
4
+import org.junit.Assert;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+public class IntegerPrinterTest {
9
+
10
+    IntegerPrinter integerPrinter;
11
+
12
+    @Before
13
+    public void setUp(){
14
+        integerPrinter = new IntegerPrinter();
15
+    }
16
+
17
+    @Test
18
+    public void printIntegerAsBinaryTest(){
19
+        //:Given
20
+        String expected = "111110100";
21
+
22
+        //:When
23
+        String actual = integerPrinter.printIntegerAsBinary(500);
24
+
25
+        //:Then
26
+        Assert.assertEquals("The value equals 111110100", expected, actual);
27
+    }
28
+
29
+    @Test
30
+    public void printIntegerAsHexadecimal(){
31
+        //:Given
32
+        String expected = "1f4";
33
+
34
+        //:When
35
+        String actual = integerPrinter.printIntegerAsHexadecimal(500);
36
+
37
+        //:Then
38
+        Assert.assertEquals("The value equals 1f4", expected, actual);
39
+    }
40
+
41
+    @Test
42
+    public void printIntegerAsOctalTest(){
43
+        //:Given
44
+        String expected = "764";
45
+
46
+        //:When
47
+        String actual = integerPrinter.printIntegerAsOctal(500);
48
+
49
+        //:Then
50
+        Assert.assertEquals("The value equals 764", expected, actual);
51
+    }
52
+
53
+}

+ 13
- 0
LargestInteger.java Parādīt failu

@@ -0,0 +1,13 @@
1
+ 
2
+
3
+
4
+public class LargestInteger {
5
+
6
+    public Integer findLargestNumberUsingConditional(Integer[] integers){
7
+        return null;
8
+    }
9
+
10
+    public Integer findLargestNumberUsingMathMax(Integer[] integers){
11
+        return null;
12
+    }
13
+}

+ 40
- 0
LargestIntegerTest.java Parādīt failu

@@ -0,0 +1,40 @@
1
+ 
2
+
3
+
4
+import org.junit.Assert;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+public class LargestIntegerTest {
9
+
10
+    private LargestInteger largestInteger;
11
+
12
+    @Before
13
+    public void setUp(){
14
+        largestInteger = new LargestInteger();
15
+    }
16
+
17
+    @Test
18
+    public void findLargestNumberUsingConditionalTest(){
19
+        // :Given
20
+        Integer expected = 30;
21
+
22
+        // :When
23
+        Integer actual = largestInteger.findLargestNumberUsingConditional(new Integer[]{30,20,10});
24
+
25
+        // :Then
26
+        Assert.assertEquals("The Largest Number should be 30", expected, actual);
27
+    }
28
+
29
+    @Test
30
+    public void findLargestNumberUsingMathMaxTest(){
31
+        // :Given
32
+        Integer expected = 600;
33
+
34
+        // :When
35
+        Integer actual = largestInteger.findLargestNumberUsingMathMax(new Integer[]{300,200,600});
36
+
37
+        // :Then
38
+        Assert.assertEquals("The Largest Number should be 600.", expected, actual);
39
+    }
40
+}

+ 17
- 0
NormalizeAngle.java Parādīt failu

@@ -0,0 +1,17 @@
1
+ 
2
+
3
+
4
+public class NormalizeAngle {
5
+
6
+    public Integer normalizeValueUsingModulo(Integer angle){
7
+        return 0;
8
+    }
9
+
10
+    public Integer normalizeValueUsingFloorMod(Integer integer){
11
+        return 0;
12
+    }
13
+
14
+    public static void main(String[] args){
15
+
16
+    }
17
+}

+ 40
- 0
NormalizeAngleTest.java Parādīt failu

@@ -0,0 +1,40 @@
1
+ 
2
+
3
+
4
+import org.junit.Assert;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+public class NormalizeAngleTest {
9
+
10
+    private NormalizeAngle normalizeAngle;
11
+
12
+    @Before
13
+    public void setUp(){
14
+        normalizeAngle = new NormalizeAngle();
15
+    }
16
+
17
+    @Test
18
+    public void normalizeValueUsingModuloTest(){
19
+        //:Given
20
+        Integer expected = 60;
21
+
22
+        //:When
23
+        Integer actual = normalizeAngle.normalizeValueUsingModulo(780);
24
+
25
+        //:Then
26
+        Assert.assertEquals("The value equals 60", expected, actual);
27
+    }
28
+
29
+    @Test
30
+    public void normalizeValueUsingFloorModTest(){
31
+        //:Given
32
+        Integer expected = 60;
33
+
34
+        //:When
35
+        Integer actual = normalizeAngle.normalizeValueUsingFloorMod(780);
36
+
37
+        //:Then
38
+        Assert.assertEquals("The value equals 60", expected, actual);
39
+    }
40
+}

+ 5
- 0
ShortCalculator.java Parādīt failu

@@ -0,0 +1,5 @@
1
+ 
2
+
3
+
4
+public class ShortCalculator {
5
+}

+ 5
- 0
ShortCalculatorTest.java Parādīt failu

@@ -0,0 +1,5 @@
1
+ 
2
+
3
+
4
+public class ShortCalculatorTest {
5
+}