Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
2
2023assignment2
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cosc250-2023
2023assignment2
Commits
359f2de1
Commit
359f2de1
authored
4 years ago
by
William Billingsley
Browse files
Options
Downloads
Patches
Plain Diff
Switch to munit for Vec2D tests
parent
07fb8243
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/test/scala/cosc250/boids/Vec2Spec.scala
+0
-40
0 additions, 40 deletions
src/test/scala/cosc250/boids/Vec2Spec.scala
src/test/scala/cosc250/boids/Vec2Suite.scala
+37
-0
37 additions, 0 deletions
src/test/scala/cosc250/boids/Vec2Suite.scala
with
37 additions
and
40 deletions
src/test/scala/cosc250/boids/Vec2Spec.scala
deleted
100644 → 0
+
0
−
40
View file @
07fb8243
package
cosc250.boids
import
org.scalatest._
/**
*
*/
class
Vec2Spec
extends
FlatSpec
with
Matchers
{
"Vec2"
should
"be able to add vectors"
in
{
Vec2
(
1
,
2
)
+
Vec2
(
3
,
4
)
should
be
(
Vec2
(
4
,
6
))
}
it
should
"be able to subtract vectors"
in
{
Vec2
(
8
,
9
)
-
Vec2
(
3
,
4
)
should
be
(
Vec2
(
5
,
5
))
}
it
should
"be able to multiply a vector by a number"
in
{
Vec2
(
8
,
9
)
*
4
should
be
(
Vec2
(
32
,
36
))
}
it
should
"be able to divide a vector by a number"
in
{
Vec2
(
8
,
6
)
/
2
should
be
(
Vec2
(
4
,
3
))
}
it
should
"limit the size of a vector"
in
{
Vec2
(
10
,
0
).
limit
(
5
)
should
be
(
Vec2
(
5
,
0
))
}
it
should
"calculcate vectors from a direction and an angle in radians"
in
{
val
Vec2
(
x
,
y
)
=
Vec2
.
fromRTheta
(
4
,
Math
.
PI
)
// There could be a rounding error -- these are doubles, so floor them as
// we know where Math.PI should go
Vec2
(
x
.
floor
,
y
.
floor
)
should
be
(
Vec2
(-
4
,
0
))
}
}
This diff is collapsed.
Click to expand it.
src/test/scala/cosc250/boids/Vec2Suite.scala
0 → 100644
+
37
−
0
View file @
359f2de1
package
cosc250.boids
/**
*
*/
class
Vec2Suite
extends
munit
.
FunSuite
{
test
(
"Vec2 should be able to add vectors"
)
{
assertEquals
(
Vec2
(
1
,
2
)
+
Vec2
(
3
,
4
),
Vec2
(
4
,
6
))
}
test
(
"it should be able to subtract vectors"
)
{
assertEquals
(
Vec2
(
8
,
9
)
-
Vec2
(
3
,
4
),
Vec2
(
5
,
5
))
}
test
(
"it should be able to multiply a vector by a number"
)
{
assertEquals
(
Vec2
(
8
,
9
)
*
4
,
Vec2
(
32
,
36
))
}
test
(
"it should be able to divide a vector by a number"
)
{
assertEquals
(
Vec2
(
8
,
6
)
/
2
,
Vec2
(
4
,
3
))
}
test
(
"it should limit the size of a vector"
)
{
assertEquals
(
Vec2
(
10
,
0
).
limit
(
5
),
Vec2
(
5
,
0
))
}
test
(
"it should calculcate vectors from a direction and an angle in radians"
)
{
val
Vec2
(
x
,
y
)
=
Vec2
.
fromRTheta
(
4
,
Math
.
PI
)
// There could be a rounding error -- these are doubles, so floor them as
// we know where Math.PI should go
assertEquals
(
Vec2
(
x
.
floor
,
y
.
floor
),
Vec2
(-
4
,
0
))
}
}
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