-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector.tests.ps1
More file actions
43 lines (39 loc) · 1.2 KB
/
Vector.tests.ps1
File metadata and controls
43 lines (39 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
describe Vector {
it 'It a collection of points' {
$vector = Vector 1..4
$vector.GetType() | Should -Be ([object[]])
$vector |
Should -BeOfType ([int])
}
it 'Can be a two dimensional vector' {
Vector2 3,4 | Should -BeOfType ([Numerics.Vector2])
}
it 'Can be a three dimensional vector' {
Vector3 1,2,3 | Should -BeOfType ([Numerics.Vector3])
}
it 'Can be a four dimensional vector' {
Vector4 1,2,3,4 | Should -BeOfType ([Numerics.Vector4])
}
context 'Vector Math' {
it 'Can subtract vectors' {
$subtract = (v2 1 2) - (v2 1 2)
$subtract.X | Should -Be 0
$subtract.Y | Should -Be 0
}
it 'Can add vectors' {
$add = (v2 1 2) + (v2 1 2)
$add.X | Should -Be 2
$add.Y | Should -Be 4
}
it 'Can multiply vectors' {
$multiply = (v2 1 2) * (v2 1 2)
$multiply.X | Should -Be 1
$multiply.Y | Should -Be 4
}
it 'Can divide vectors' {
$divide = (v2 1 2) / (v2 1 2)
$divide.X | Should -Be 1
$divide.Y | Should -Be 1
}
}
}