Skip to content

Commit 670954a

Browse files
feat: Vector tests ( Fixes #6 )
1 parent 4c66c8f commit 670954a

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Vector.tests.ps1

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
describe Vector {
2+
it 'It a collection of points' {
3+
$vector = Vector 1..4
4+
$vector.GetType() | Should -Be ([object[]])
5+
$vector |
6+
Should -BeOfType ([int])
7+
}
8+
9+
it 'Can be a two dimensional vector' {
10+
Vector2 3,4 | Should -BeOfType ([Numerics.Vector2])
11+
}
12+
13+
it 'Can be a three dimensional vector' {
14+
Vector3 1,2,3 | Should -BeOfType ([Numerics.Vector3])
15+
}
16+
17+
it 'Can be a four dimensional vector' {
18+
Vector4 1,2,3,4 | Should -BeOfType ([Numerics.Vector4])
19+
}
20+
21+
context 'Vector Math' {
22+
it 'Can subtract vectors' {
23+
$subtract = (v2 1 2) - (v2 1 2)
24+
$subtract.X | Should -Be 0
25+
$subtract.Y | Should -Be 0
26+
}
27+
it 'Can add vectors' {
28+
$add = (v2 1 2) + (v2 1 2)
29+
$add.X | Should -Be 2
30+
$add.Y | Should -Be 4
31+
}
32+
it 'Can multiply vectors' {
33+
$multiply = (v2 1 2) * (v2 1 2)
34+
$multiply.X | Should -Be 1
35+
$multiply.Y | Should -Be 4
36+
}
37+
it 'Can divide vectors' {
38+
$divide = (v2 1 2) / (v2 1 2)
39+
$divide.X | Should -Be 1
40+
$divide.Y | Should -Be 1
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)