Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS682-HW1-OrderMatching
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rohit Prasad
CS682-HW1-OrderMatching
Commits
1057ca77
Commit
1057ca77
authored
Jan 22, 2018
by
Rohit Prasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests to validate orders
parent
fe442348
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
src/OrderMatchingTest.java
src/OrderMatchingTest.java
+21
-0
No files found.
src/OrderMatchingTest.java
View file @
1057ca77
...
@@ -51,4 +51,25 @@ class OrderMatchingTest {
...
@@ -51,4 +51,25 @@ class OrderMatchingTest {
System
.
out
.
println
(
orderMatching
.
printSellOrderQueue
());
System
.
out
.
println
(
orderMatching
.
printSellOrderQueue
());
}
}
@Test
void
validateOrderTest
()
{
Customer
c1
=
new
Customer
(
"c1"
);
Customer
c2
=
new
Customer
(
"c2"
);
Stock
appleStock
=
new
Stock
(
"apple"
);
Stock
googleStock
=
new
Stock
(
"google"
);
OrderMatching
orderMatching
=
new
OrderMatching
();
BuyOrder
b1
=
new
BuyOrder
(
1
,
c1
,
googleStock
,
100
,
300
);
BuyOrder
b2
=
new
BuyOrder
(
2
,
c2
,
googleStock
,
300
,
200
);
BuyOrder
b3
=
new
BuyOrder
(
5
,
c1
,
googleStock
,
-
300
,
200
);
SellOrder
s1
=
new
SellOrder
(
3
,
c2
,
googleStock
,
200
,
200
);
SellOrder
s2
=
new
SellOrder
(
4
,
c2
,
appleStock
,
200
,
-
200
);
assertTrue
(
orderMatching
.
validate
(
b1
));
assertTrue
(
orderMatching
.
validate
(
b2
));
assertFalse
(
orderMatching
.
validate
(
b3
));
assertTrue
(
orderMatching
.
validate
(
s1
));
assertFalse
(
orderMatching
.
validate
(
s2
));
}
}
}
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