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
306
306Ass5
Commits
fa96d939
Commit
fa96d939
authored
Mar 26, 2019
by
michael lundquist
Browse files
Spiffing up the test methods with random numbers and deleting some unnecessary prints
parent
797edb9b
Changes
2
Show whitespace changes
Inline
Side-by-side
fifthassignment/src/main/java/com/ds/fifthassignment/Application.java
View file @
fa96d939
package
com.ds.fifthassignment
;
package
com.ds.fifthassignment
;
import
java.util
.Stack
;
import
com.ds.fifthassignment
.Stack
;
public
class
Application
{
public
class
Application
{
public
class
Bracket
{
public
class
Bracket
{
...
@@ -18,7 +18,7 @@ public class Application {
...
@@ -18,7 +18,7 @@ public class Application {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
char
[]
input1
=
input1
=
"[(4+5+1) x (4 / 2)]"
.
toCharArray
();
char
[]
input1
=
"[(4+5+1) x (4 / 2)]"
.
toCharArray
();
char
[]
input2
=
"[(4+5+1) x (4 / 2]"
.
toCharArray
();
char
[]
input2
=
"[(4+5+1) x (4 / 2]"
.
toCharArray
();
System
.
out
.
println
(
isValid
(
input1
));
System
.
out
.
println
(
isValid
(
input1
));
System
.
out
.
println
(
isValid
(
input2
));
System
.
out
.
println
(
isValid
(
input2
));
...
...
fifthassignment/src/test/java/com/ds/fifthassignment/AppTest.java
View file @
fa96d939
...
@@ -83,9 +83,7 @@ public class AppTest
...
@@ -83,9 +83,7 @@ public class AppTest
*/
*/
@Test
@Test
public
void
test_LL_StackSearch
(){
public
void
test_LL_StackSearch
(){
//Integer test = randRange(1,10);
Integer
test
=
randRange
(
1
,
10
);
int
test
=
4
;
JOptionPane
.
showMessageDialog
(
null
,
"hi"
);
LinkedListStack
s
=
new
LinkedListStack
();
LinkedListStack
s
=
new
LinkedListStack
();
for
(
int
k
=
1
;
k
<=
10
;
k
++){
for
(
int
k
=
1
;
k
<=
10
;
k
++){
...
@@ -95,8 +93,8 @@ public class AppTest
...
@@ -95,8 +93,8 @@ public class AppTest
s
.
push
(
"a"
);
s
.
push
(
"a"
);
}
}
}
}
JOptionPane
.
showMessageDialog
(
null
,
"the value of test is: "
+
(
11
-
test
)
);
//
JOptionPane.showMessageDialog(null, "the value of test is: " + (11 - test) );
JOptionPane
.
showMessageDialog
(
null
,
"The search result: "
+
s
.
search
(
"b"
));
//
JOptionPane.showMessageDialog(null, "The search result: " + s.search("b"));
assertTrue
(
s
.
search
(
"b"
)
==
(
11
-
test
));
assertTrue
(
s
.
search
(
"b"
)
==
(
11
-
test
));
//assertTrue(false);
//assertTrue(false);
}
}
...
@@ -106,9 +104,8 @@ public class AppTest
...
@@ -106,9 +104,8 @@ public class AppTest
*/
*/
@Test
@Test
public
void
testArrayStackSearch
(){
public
void
testArrayStackSearch
(){
//Integer test = randRange(1,10);
Integer
test
=
randRange
(
1
,
10
);
int
test
=
4
;
JOptionPane
.
showMessageDialog
(
null
,
"hi"
);
ArrayStack
s
=
new
ArrayStack
();
ArrayStack
s
=
new
ArrayStack
();
for
(
int
k
=
1
;
k
<=
10
;
k
++){
for
(
int
k
=
1
;
k
<=
10
;
k
++){
...
@@ -118,9 +115,9 @@ public class AppTest
...
@@ -118,9 +115,9 @@ public class AppTest
s
.
push
(
"a"
);
s
.
push
(
"a"
);
}
}
}
}
JOptionPane
.
showMessageDialog
(
null
,
"the value of test is: "
+
(
11
-
test
)
);
//
JOptionPane.showMessageDialog(null, "the value of test is: " + (11 - test) );
int
ser
=
s
.
search
(
"b"
);
int
ser
=
s
.
search
(
"b"
);
JOptionPane
.
showMessageDialog
(
null
,
"The search result: "
+
ser
);
//
JOptionPane.showMessageDialog(null, "The search result: " + ser);
assertTrue
(
ser
==
(
11
-
test
));
assertTrue
(
ser
==
(
11
-
test
));
//assertTrue(false);
//assertTrue(false);
}
}
...
@@ -130,6 +127,12 @@ public class AppTest
...
@@ -130,6 +127,12 @@ public class AppTest
*/
*/
@Test
@Test
public
void
testQueueElement
(){
public
void
testQueueElement
(){
Integer
test
=
randRange
(
1
,
10
);
ArrayStack
s
=
new
ArrayStack
();
for
(
int
k
=
1
;
k
<=
10
;
k
++){
s
.
push
(
"a"
);
}
s
.
push
(
"b"
);
assertTrue
(
true
);
assertTrue
(
true
);
}
}
...
@@ -138,6 +141,12 @@ public class AppTest
...
@@ -138,6 +141,12 @@ public class AppTest
*/
*/
@Test
@Test
public
void
test_LL_QueueElement
(){
public
void
test_LL_QueueElement
(){
Integer
test
=
randRange
(
1
,
10
);
LinkedListQueue
q
=
new
LinkedListQueue
();
for
(
int
k
=
1
;
k
<=
10
;
k
++){
q
.
push
(
"a"
);
}
q
.
push
(
"b"
);
assertTrue
(
true
);
assertTrue
(
true
);
}
}
...
...
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