v / vlib / math / square_test.v
21 lines · 19 sloc · 470 bytes · fb0f12f937ee9d943f9adafa3d350aff65105215
Raw
1import math
2
3fn test_square() {
4 assert math.square(0) == 0
5 assert math.square(1) == 1
6 assert math.square(-1) == 1
7 assert math.square(5) == 25
8 assert math.square(u8(3)) == 9
9 assert math.square(u32(10)) == 100
10 assert math.square(-7) == 49
11}
12
13fn test_cube() {
14 assert math.cube(0) == 0
15 assert math.cube(1) == 1
16 assert math.cube(-1) == -1
17 assert math.cube(5) == 125
18 assert math.cube(u8(3)) == 27
19 assert math.cube(u32(10)) == 1000
20 assert math.cube(-7) == -343
21}
22