-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAppTest.java
More file actions
30 lines (25 loc) · 910 Bytes
/
AppTest.java
File metadata and controls
30 lines (25 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.example;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class AppTest {
@Test
public void testSumToN() {
int result = App.sum_to_n(10);
assertEquals(55, result, "The sum_to_n function should return 55 for input 10");
}
@Test
public void testBubbleSort() {
int[] input = {5, 3, 8, 1, 2};
int[] expected = {1, 2, 3, 5, 8};
int[] result = App.bubble_sort(input);
assertArrayEquals(expected, result, "The bubble_sort function should sort the array correctly");
}
@Test
public void testFibonacci() {
int input = 8;
int expected = 21;
int result = App.fibonacci(input);
assertEquals(expected, result, "The fibonacci function should return 21 for input 8");
}
}