MCPcopy Create free account
hub / github.com/Berkeley-CS61B/skeleton-sp23 / ArithmeticTest

Class ArithmeticTest

lab01/tests/ArithmeticTest.java:10–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import static com.google.common.truth.Truth.assertThat;
9
10@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
11public class ArithmeticTest {
12
13 /** Performs a few arbitrary tests to see if the product method is
14 * correct */
15 @Test
16 @Order(0)
17 @DisplayName("Test product correctness")
18 public void testProduct() {
19 assertThat(Arithmetic.product(5, 6)).isEqualTo(30);
20 assertThat(Arithmetic.product(5, -6)).isEqualTo(-30);
21 assertThat(Arithmetic.product(0, -6)).isEqualTo(0);
22 }
23
24 /** Performs a few arbitrary tests to see if the sum method is correct */
25 @Test
26 @Order(1)
27 @DisplayName("Test sum correctness")
28 public void testSum() {
29 assertThat(Arithmetic.sum(5, 6)).isEqualTo(11);
30 assertThat(Arithmetic.sum(5, -6)).isEqualTo(-1);
31 assertThat(Arithmetic.sum(0, -6)).isEqualTo(-6);
32 assertThat(Arithmetic.sum(6, -6)).isEqualTo(0);
33 }
34}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected