generated from UofSC-Fall-2022-Math-587-001/homework8
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hw9_test.go
95 lines (89 loc) · 3.74 KB
/
hw9_test.go
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package hw9
import (
"reflect"
"testing"
)
func Test1(t *testing.T) {
N := 10
B := 2
bsmooth := Psi(B,N)
want := []int{2,4,8}
if !reflect.DeepEqual(bsmooth,want){
t.Errorf("The %d-smooth integers <= %d are %d but you returned %d\n",B,N,want,bsmooth)
}
}
func Test2(t *testing.T) {
N := 20
B := 3
bsmooth := Psi(B,N)
want := []int{2,3,4,6,8,9,12,16,18}
if !reflect.DeepEqual(bsmooth,want){
t.Errorf("The %d-smooth integers <= %d are %d but you returned %d\n",B,N,want,bsmooth)
}
}
func Test3(t *testing.T) {
N := 20
B := 10
bsmooth := Psi(B,N)
want := []int{2,3,4,5,6,7,8,9,10,12,14,15,16,18,20}
if !reflect.DeepEqual(bsmooth,want){
t.Errorf("The %d-smooth integers <= %d are %d but you returned %d\n",B,N,want,bsmooth)
}
}
func Test4(t *testing.T) {
N := 100
B := 100
bsmooth := Psi(B,N)
var want []int
for i := 2; i <= N; i++ {
want = append(want,i)
}
if !reflect.DeepEqual(bsmooth,want){
t.Errorf("The %d-smooth integers <= %d are %d but you returned %d\n",B,N,want,bsmooth)
}
}
func Test5(t *testing.T) {
N := 1000
B := 50
bsmooth := Psi(B,N)
want := []int{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, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54,
55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77,
78, 80, 81, 82, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 95, 96, 98, 99,
100, 102, 104, 105, 108, 110, 111, 112, 114, 115, 116, 117, 119, 120,
121, 123, 124, 125, 126, 128, 129, 130, 132, 133, 135, 136,
138, 140, 141, 143, 144, 145, 147, 148, 150, 152, 153, 154, 155,
156, 160, 161, 162, 164, 165, 168, 169, 170, 171, 172, 174, 175, 176,
180, 182, 184, 185, 186, 187, 188, 189, 190, 192, 195, 196, 198, 200,
203, 204, 205, 207, 208, 209, 210, 215, 216, 217, 220, 221, 222, 224,
225, 228, 230, 231, 232, 234, 235, 238, 240, 242, 243, 245, 246, 247,
248, 250, 252, 253, 255, 256, 258, 259, 260, 261, 264, 266, 270, 272,
273, 275, 276, 279, 280, 282, 285, 286, 287, 288, 289, 290, 294, 296,
297, 299, 300, 301, 304, 306, 308, 310, 312, 315, 319, 320, 322, 323,
324, 325, 328, 329, 330, 333, 336, 338, 340, 341, 342, 343, 344, 345,
348, 350, 351, 352, 357, 360, 361, 363, 364, 368, 369, 370, 372, 374,
375, 376, 377, 378, 380, 384, 385, 387, 390, 391, 392, 396, 399, 400,
403, 405, 406, 407, 408, 410, 414, 416, 418, 420, 423, 425, 429, 430,
432, 434, 435, 437, 440, 441, 442, 444, 448, 450, 451, 455, 456, 459,
460, 462, 464, 465, 468, 470, 473, 475, 476, 480, 481, 483, 484, 486,
490, 492, 493, 494, 495, 496, 500, 504, 506, 507, 510, 512, 513, 516,
517, 518, 520, 522, 525, 527, 528, 529, 532, 533, 539, 540, 544, 546,
550, 551, 552, 555, 558, 559, 560, 561, 564, 567, 570, 572, 574, 575,
576, 578, 580, 585, 588, 589, 592, 594, 595, 598, 600, 602, 605, 608,
609, 611, 612, 615, 616, 620, 621, 624, 625, 627, 629, 630, 637, 638,
640, 644, 645, 646, 648, 650, 651, 656, 658, 660, 663, 665, 666, 667,
672, 675, 676, 680, 682, 684, 686, 688, 690, 693, 696, 697, 700, 702,
703, 704, 705, 713, 714, 715, 720, 722, 725, 726, 728, 729, 731, 735,
736, 738, 740, 741, 744, 748, 750, 752, 754, 756, 759, 760, 765, 768,
770, 774, 775, 777, 779, 780, 782, 783, 784, 792, 798, 799, 800, 805,
806, 810, 812, 814, 816, 817, 819, 820, 825, 828, 832, 833, 836, 837,
840, 841, 845, 846, 847, 850, 851, 855, 858, 860, 861, 864, 867, 868,
870, 874, 875, 880, 882, 884, 888, 891, 893, 896, 897, 899, 900, 902,
903, 910, 912, 918, 920, 924, 925, 928, 930, 931, 935, 936, 940, 943,
945, 946, 950, 952, 957, 960, 961, 962, 966, 968, 969, 972, 975, 980,
984, 986, 987, 988, 989, 990, 992, 999, 1000}
if !reflect.DeepEqual(bsmooth,want){
t.Errorf("The %d-smooth integers <= %d are %d but you returned %d\n",B,N,want,bsmooth)
}
}