forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyAtoiTest.java
More file actions
43 lines (33 loc) · 785 Bytes
/
MyAtoiTest.java
File metadata and controls
43 lines (33 loc) · 785 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
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.thealgorithms.strings;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class MyAtoiTest {
@Test
void testOne() {
assertEquals(42, MyAtoi.myAtoi("42"));
}
@Test
void testTwo() {
assertEquals(-42, MyAtoi.myAtoi(" -42"));
}
@Test
void testThree() {
assertEquals(4193, MyAtoi.myAtoi("4193 with words"));
}
@Test
void testFour() {
assertEquals(0, MyAtoi.myAtoi("0"));
}
@Test
void testFive() {
assertEquals(5678, MyAtoi.myAtoi("5678"));
}
@Test
void testSix() {
assertEquals(42, MyAtoi.myAtoi("+42"));
}
@Test
void testSeven() {
assertEquals(0, MyAtoi.myAtoi(" +0 "));
}
}