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
fd139d24
Commit
fd139d24
authored
Sep 16, 2018
by
Zhaolin Deng
Browse files
Options
Downloads
Patches
Plain Diff
Replace PartitioningTests.java
parent
a9a9fe86
Branches
master
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/PartitioningTests.java
+33
-42
33 additions, 42 deletions
test/swen90006/machine/PartitioningTests.java
with
33 additions
and
42 deletions
test/swen90006/machine/PartitioningTests.java
+
33
−
42
View file @
fd139d24
...
...
@@ -26,18 +26,9 @@ public class PartitioningTests
//Any method annotation with "@Test" is executed as a test.
@Test
public
void
ec2Test
()
{
//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
()
@Test
(
expected
=
swen90006
.
machine
.
NoReturnValueException
.
class
)
public
void
ec3Test
()
{
//the assertEquals method used to check whether two values are
//equal, using the equals method
...
...
@@ -45,7 +36,7 @@ public class PartitioningTests
list
.
add
(
"jmp 10"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
NoReturnValueException
)
;
m
.
execute
(
list
);
}
@Test
public
void
ec4Test
()
...
...
@@ -59,7 +50,8 @@ public class PartitioningTests
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
//equal, using the equals method
...
...
@@ -67,17 +59,18 @@ public class PartitioningTests
list
.
add
(
"jmp 66666"
);
list
.
add
(
"ret R0"
);
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
//equal, using the equals method
List
<
String
>
list
=
new
ArrayList
<
String
>();
list
.
add
(
"ret R40"
);
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
@Test
public
void
ec7Test
()
...
...
@@ -101,7 +94,8 @@ public class PartitioningTests
assertEquals
(
m
.
execute
(
list
),
5
);
}
@Test
public
void
ec9Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec9Test
()
{
//the assertEquals method used to check whether two values are
//equal, using the equals method
...
...
@@ -109,21 +103,12 @@ public class PartitioningTests
list
.
add
(
"mov R1 66666"
);
list
.
add
(
"ret R1"
);
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
//equal, using the equals method
...
...
@@ -157,7 +142,8 @@ public class PartitioningTests
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
//equal, using the equals method
...
...
@@ -166,10 +152,11 @@ public class PartitioningTests
list
.
add
(
"ldr R0 R1 66666"
);
list
.
add
(
"ret R0"
);
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
//equal, using the equals method
...
...
@@ -178,10 +165,11 @@ public class PartitioningTests
list
.
add
(
"ldr R0 R1 0"
);
list
.
add
(
"ret R0"
);
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
//equal, using the equals method
...
...
@@ -189,10 +177,11 @@ public class PartitioningTests
list
.
add
(
"ldr R0 R40 0"
);
list
.
add
(
"ret R0"
);
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
//equal, using the equals method
...
...
@@ -200,10 +189,11 @@ public class PartitioningTests
list
.
add
(
"str R0 0 R40"
);
list
.
add
(
"ret R0"
);
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
//equal, using the equals method
...
...
@@ -212,7 +202,7 @@ public class PartitioningTests
list
.
add
(
"str R1 0 R0"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
@Test
public
void
ec20Test
()
...
...
@@ -228,7 +218,8 @@ public class PartitioningTests
assertEquals
(
m
.
execute
(
list
),
30
);
}
@Test
public
void
ec21Test
()
@Test
(
expected
=
swen90006
.
machine
.
InvalidInstructionException
.
class
)
public
void
ec21Test
()
{
//the assertEquals method used to check whether two values are
//equal, using the equals method
...
...
@@ -236,7 +227,7 @@ public class PartitioningTests
list
.
add
(
"add R0 R1 R40"
);
list
.
add
(
"ret R0"
);
Machine
m
=
new
Machine
();
assertEquals
(
m
.
execute
(
list
)
,
InvalidInstructionException
)
;
m
.
execute
(
list
);
}
@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