Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CSE 332 21au Students
para-practice
Commits
0739ce29
Commit
0739ce29
authored
Nov 08, 2021
by
WinJ
Browse files
refactored tests
parent
5a33f2a1
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/main/java/CountStrs.java
View file @
0739ce29
...
...
@@ -52,10 +52,4 @@ public class CountStrs {
return
0
;
// TODO: you may want to change this
}
}
public
static
void
main
(
String
[]
args
)
{
String
[]
arr
=
{
"h"
,
"ee"
,
"llll"
,
"llll"
,
"oo"
,
"llll"
};
System
.
out
.
println
(
parallel
(
arr
,
"llll"
)
+
" should be 3."
);
System
.
out
.
println
(
parallel
(
arr
,
"h"
)
+
" should be 1."
);
}
}
src/main/java/LessThan7.java
View file @
0739ce29
...
...
@@ -46,8 +46,4 @@ public class LessThan7 {
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
parallel
(
new
int
[]{
21
,
7
,
6
,
8
,
17
,
1
,
7
,
7
,
1
,
1
,
7
})
+
" should be 4."
);
}
}
src/main/java/Parity.java
View file @
0739ce29
...
...
@@ -50,9 +50,4 @@ public class Parity {
return
false
;
// TODO: you may want to change this
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
parallel
(
new
int
[]{
1
,
7
,
4
,
3
,
6
})
+
" should be true."
);
System
.
out
.
println
(
parallel
(
new
int
[]{
6
,
5
,
4
,
3
,
2
,
1
})
+
" should be false."
);
}
}
src/main/java/PowMod.java
View file @
0739ce29
...
...
@@ -52,10 +52,4 @@ public class PowMod {
}
}
public
static
void
main
(
String
[]
args
)
{
int
[]
arr
=
{
1
,
7
,
4
,
3
,
6
};
parallel
(
arr
,
6
,
5000
);
System
.
out
.
println
(
Arrays
.
toString
(
arr
)
+
" should be [1, 2649, 4096, 729, 1656]"
);
}
}
src/main/java/SecondSmallest.java
View file @
0739ce29
...
...
@@ -69,9 +69,4 @@ public class SecondSmallest {
return
new
TwoSmallest
();
// TODO: you may want to change this
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
parallel
(
new
int
[]{
1
,
7
,
4
,
3
,
6
})
+
" should be 3."
);
System
.
out
.
println
(
parallel
(
new
int
[]{
6
,
1
,
4
,
3
,
5
,
2
,
1
})
+
" should be 2."
);
}
}
src/test/java/CountStrsTests.java
0 → 100644
View file @
0739ce29
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
CountStrsTests
{
@Test
public
void
testCountStrs
()
{
String
[]
arr
=
{
"h"
,
"ee"
,
"llll"
,
"llll"
,
"oo"
,
"llll"
};
assertEquals
(
3
,
CountStrs
.
parallel
(
arr
,
"llll"
));
assertEquals
(
1
,
CountStrs
.
parallel
(
arr
,
"h"
));
}
}
src/test/java/LessThan7Tests.java
0 → 100644
View file @
0739ce29
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
LessThan7Tests
{
@Test
public
void
testLessThan7
()
{
assertEquals
(
4
,
LessThan7
.
parallel
(
new
int
[]{
21
,
7
,
6
,
8
,
17
,
1
,
7
,
7
,
1
,
1
,
7
}));
}
}
src/test/java/ParityTests.java
0 → 100644
View file @
0739ce29
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
ParityTests
{
@Test
public
void
testParity
()
{
assertTrue
(
Parity
.
parallel
(
new
int
[]{
1
,
7
,
4
,
3
,
6
}));
assertFalse
(
Parity
.
parallel
(
new
int
[]{
6
,
5
,
4
,
3
,
2
,
1
}));
}
}
src/test/java/PowModTests.java
0 → 100644
View file @
0739ce29
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
PowModTests
{
@Test
public
void
testPowMod
()
{
int
[]
arr
=
{
1
,
7
,
4
,
3
,
6
};
int
[]
expected
=
{
1
,
2649
,
4096
,
729
,
1656
};
PowMod
.
parallel
(
arr
,
6
,
5000
);
assertArrayEquals
(
expected
,
arr
);
}
}
src/test/java/SecondSmallestTests.java
0 → 100644
View file @
0739ce29
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
SecondSmallestTests
{
@Test
public
void
testSecondSmallest
()
{
assertEquals
(
3
,
SecondSmallest
.
parallel
(
new
int
[]{
1
,
7
,
4
,
3
,
6
}));
assertEquals
(
2
,
SecondSmallest
.
parallel
(
new
int
[]{
6
,
1
,
4
,
3
,
5
,
2
,
1
}));
}
}
src/test/java/TestBasic.java
deleted
100644 → 0
View file @
5a33f2a1
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
TestBasic
{
@Test
public
void
testCountStrs
()
{
String
[]
arr
=
{
"h"
,
"ee"
,
"llll"
,
"llll"
,
"oo"
,
"llll"
};
assertEquals
(
3
,
CountStrs
.
parallel
(
arr
,
"llll"
));
assertEquals
(
1
,
CountStrs
.
parallel
(
arr
,
"h"
));
}
@Test
public
void
testLessThan7
()
{
assertEquals
(
4
,
LessThan7
.
parallel
(
new
int
[]{
21
,
7
,
6
,
8
,
17
,
1
,
7
,
7
,
1
,
1
,
7
}));
}
@Test
public
void
testParity
()
{
assertTrue
(
Parity
.
parallel
(
new
int
[]{
1
,
7
,
4
,
3
,
6
}));
assertFalse
(
Parity
.
parallel
(
new
int
[]{
6
,
5
,
4
,
3
,
2
,
1
}));
}
@Test
public
void
testPowMod
()
{
int
[]
arr
=
{
1
,
7
,
4
,
3
,
6
};
int
[]
expected
=
{
1
,
2649
,
4096
,
729
,
1656
};
PowMod
.
parallel
(
arr
,
6
,
5000
);
assertArrayEquals
(
expected
,
arr
);
}
@Test
public
void
testSecondSmallest
()
{
assertEquals
(
3
,
SecondSmallest
.
parallel
(
new
int
[]{
1
,
7
,
4
,
3
,
6
}));
assertEquals
(
2
,
SecondSmallest
.
parallel
(
new
int
[]{
6
,
1
,
4
,
3
,
5
,
2
,
1
}));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment