Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
assignment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zhaolin Deng
assignment
Commits
a9a9fe86
Commit
a9a9fe86
authored
Sep 16, 2018
by
Zhaolin Deng
Browse files
Options
Downloads
Patches
Plain Diff
Replace BoundaryTests.java
parent
111a0682
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/swen90006/machine/BoundaryTests.java
+34
-44
34 additions, 44 deletions
test/swen90006/machine/BoundaryTests.java
with
34 additions
and
44 deletions
test/swen90006/machine/BoundaryTests.java
+
34
−
44
View file @
a9a9fe86
...
@@ -26,18 +26,8 @@ public class BoundaryTests
...
@@ -26,18 +26,8 @@ public class BoundaryTests
//Any method annotation with "@Test" is executed as a test.
//Any method annotation with "@Test" is executed as a test.
@Test
public
void
ec2Test
()
@Test
(
expected
=
swen90006
.
machine
.
NoReturnValueException
.
class
)
{
public
void
ec3Test
()
//the assertEquals method used to check whether two values are
//equal, using the equals method
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
.
add
(
"jmp 0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
),
"No result"
);
}
@Test
public
void
ec3Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -45,7 +35,7 @@ public class BoundaryTests
...
@@ -45,7 +35,7 @@ public class BoundaryTests
list
.
add
(
"jmp -1"
);
list
.
add
(
"jmp -1"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
NoReturnValueException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec4Test
()
@Test
public
void
ec4Test
()
...
@@ -59,7 +49,8 @@ public class BoundaryTests
...
@@ -59,7 +49,8 @@ public class BoundaryTests
assertEquals
(
m
.
execute
(
list
),
0
);
assertEquals
(
m
.
execute
(
list
),
0
);
}
}
@Test
public
void
ec5Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec5Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -67,17 +58,18 @@ public class BoundaryTests
...
@@ -67,17 +58,18 @@ public class BoundaryTests
list
.
add
(
"jmp 65536"
);
list
.
add
(
"jmp 65536"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec6Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec6Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
List
<
String
>
list
=
new
ArrayList
<
String
>();
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
.
add
(
"ret R32"
);
list
.
add
(
"ret R32"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec7Test
()
@Test
public
void
ec7Test
()
...
@@ -101,7 +93,8 @@ public class BoundaryTests
...
@@ -101,7 +93,8 @@ public class BoundaryTests
assertEquals
(
m
.
execute
(
list
),
65535
);
assertEquals
(
m
.
execute
(
list
),
65535
);
}
}
@Test
public
void
ec9Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec9Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -109,21 +102,12 @@ public class BoundaryTests
...
@@ -109,21 +102,12 @@ public class BoundaryTests
list
.
add
(
"mov R1 65536"
);
list
.
add
(
"mov R1 65536"
);
list
.
add
(
"ret R1"
);
list
.
add
(
"ret R1"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec10Test
()
{
//the assertEquals method used to check whether two values are
//equal, using the equals method
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
.
add
(
"jz R1 0"
);
list
.
add
(
"ret R1"
);
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
),
"No result"
);
}
@Test
public
void
ec11Test
()
@Test
(
expected
=
swen90006
.
machine
.
NoReturnValueException
.
class
)
public
void
ec11Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -131,7 +115,7 @@ public class BoundaryTests
...
@@ -131,7 +115,7 @@ public class BoundaryTests
list
.
add
(
"jz R1 3"
);
list
.
add
(
"jz R1 3"
);
list
.
add
(
"ret R1"
);
list
.
add
(
"ret R1"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
NoReturnValueException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec12Test
()
@Test
public
void
ec12Test
()
...
@@ -157,7 +141,8 @@ public class BoundaryTests
...
@@ -157,7 +141,8 @@ public class BoundaryTests
assertEquals
(
m
.
execute
(
list
),
0
);
assertEquals
(
m
.
execute
(
list
),
0
);
}
}
@Test
public
void
ec14Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec14Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -166,10 +151,11 @@ public class BoundaryTests
...
@@ -166,10 +151,11 @@ public class BoundaryTests
list
.
add
(
"ldr R0 R1 65536"
);
list
.
add
(
"ldr R0 R1 65536"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec15Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec15Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -178,10 +164,11 @@ public class BoundaryTests
...
@@ -178,10 +164,11 @@ public class BoundaryTests
list
.
add
(
"ldr R0 R1 0"
);
list
.
add
(
"ldr R0 R1 0"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
(
m
.
execute
(
list
);
}
}
@Test
public
void
ec16Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec16Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -189,10 +176,11 @@ public class BoundaryTests
...
@@ -189,10 +176,11 @@ public class BoundaryTests
list
.
add
(
"ldr R0 R32 0"
);
list
.
add
(
"ldr R0 R32 0"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec17Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec17Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -200,10 +188,11 @@ public class BoundaryTests
...
@@ -200,10 +188,11 @@ public class BoundaryTests
list
.
add
(
"str R0 0 R32"
);
list
.
add
(
"str R0 0 R32"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec18Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec18Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -212,7 +201,7 @@ public class BoundaryTests
...
@@ -212,7 +201,7 @@ public class BoundaryTests
list
.
add
(
"str R1 0 R0"
);
list
.
add
(
"str R1 0 R0"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec20Test
()
@Test
public
void
ec20Test
()
...
@@ -228,7 +217,8 @@ public class BoundaryTests
...
@@ -228,7 +217,8 @@ public class BoundaryTests
assertEquals
(
m
.
execute
(
list
),
65535
);
assertEquals
(
m
.
execute
(
list
),
65535
);
}
}
@Test
public
void
ec21Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec21Test
()
{
{
//the assertEquals method used to check whether two values are
//the assertEquals method used to check whether two values are
//equal, using the equals method
//equal, using the equals method
...
@@ -236,7 +226,7 @@ public class BoundaryTests
...
@@ -236,7 +226,7 @@ public class BoundaryTests
list
.
add
(
"add R0 R1 R32"
);
list
.
add
(
"add R0 R1 R32"
);
list
.
add
(
"ret R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
}
@Test
public
void
ec22Test
()
@Test
public
void
ec22Test
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment