|
1 | 1 | @testset "numbers" begin |
2 | | - # catalan |
3 | | - @test catalannum(5) == 42 |
4 | | - @test catalannum(30) == parse(BigInt, "3814986502092304") |
5 | | - @test_throws DomainError catalannum(-1) |
| 2 | + # catalan |
| 3 | + @test catalannum(5) == 42 |
| 4 | + @test catalannum(30) == parse(BigInt, "3814986502092304") |
| 5 | + @test_throws DomainError catalannum(-1) |
6 | 6 |
|
7 | | - # fibonacci |
8 | | - @test fibonaccinum(5) == 5 |
9 | | - @test fibonaccinum(101) == parse(BigInt, "573147844013817084101") |
10 | | - @test_throws DomainError fibonaccinum(-1) |
| 7 | + # fibonacci |
| 8 | + @test fibonaccinum(5) == 5 |
| 9 | + @test fibonaccinum(101) == parse(BigInt, "573147844013817084101") |
| 10 | + @test_throws DomainError fibonaccinum(-1) |
11 | 11 |
|
12 | | - # lobb |
13 | | - @test lobbnum(2, 3) == 5 |
14 | | - @test lobbnum(50, 100) == parse(BigInt, "303574146822833458064977353764024400258025594128") |
15 | | - @test_throws DomainError lobbnum(-1, 2) |
| 12 | + # lobb |
| 13 | + @test lobbnum(2, 3) == 5 |
| 14 | + @test lobbnum(50, 100) == |
| 15 | + parse(BigInt, "303574146822833458064977353764024400258025594128") |
| 16 | + @test_throws DomainError lobbnum(-1, 2) |
16 | 17 |
|
17 | | - # narayana |
18 | | - @test narayana(8, 5) == 490 |
19 | | - @test narayana(100, 50) == parse(BigInt, "99794739256977899071474889425225225330079579752931446368") |
20 | | - @test_throws DomainError narayana(-1, -1) |
| 18 | + # narayana |
| 19 | + @test narayana(8, 5) == 490 |
| 20 | + @test narayana(100, 50) == |
| 21 | + parse(BigInt, "99794739256977899071474889425225225330079579752931446368") |
| 22 | + @test_throws DomainError narayana(-1, -1) |
21 | 23 |
|
22 | | - # lassalle |
23 | | - @test lassallenum(14) == parse(BigInt, "270316008395632253340") |
| 24 | + # lassalle |
| 25 | + @test lassallenum(14) == parse(BigInt, "270316008395632253340") |
24 | 26 |
|
25 | | - # legendresymbol |
26 | | - @test legendresymbol(1001, 9907) == jacobisymbol(1001, 9907) == -1 |
| 27 | + # legendresymbol |
| 28 | + @test legendresymbol(1001, 9907) == jacobisymbol(1001, 9907) == -1 |
27 | 29 |
|
28 | | - # lucas |
29 | | - @test lucasnum(10) == 123 |
30 | | - @test lucasnum(100) == parse(BigInt, "792070839848372253127") |
31 | | - @test_throws DomainError lucasnum(-1) |
| 30 | + # lucas |
| 31 | + @test lucasnum(10) == 123 |
| 32 | + @test lucasnum(100) == parse(BigInt, "792070839848372253127") |
| 33 | + @test_throws DomainError lucasnum(-1) |
32 | 34 |
|
33 | | - # stirlings1 |
34 | | - @test_throws DomainError stirlings1(-1, 1) |
35 | | - @test typeof(stirlings1(6, 2)) == Int |
36 | | - @test stirlings1(0, 0) == 1 |
37 | | - @test stirlings1(1, 1) == 1 |
38 | | - @test stirlings1(2, 6) == 0 |
39 | | - @test stirlings1(6, 0) == 0 |
40 | | - @test stirlings1(6, 0, true) == 0 |
41 | | - @test stirlings1(6, 1) == 120 |
42 | | - @test stirlings1(6, 1, true) == -120 |
43 | | - @test stirlings1(6, 2) == 274 |
44 | | - @test stirlings1(6, 2, true) == 274 |
45 | | - @test stirlings1(6, 3) == 225 |
46 | | - @test stirlings1(6, 3, true) == -225 |
47 | | - @test stirlings1(6, 4) == 85 |
48 | | - @test stirlings1(6, 4, true) == 85 |
49 | | - @test stirlings1(6, 5) == 15 |
50 | | - @test stirlings1(6, 5, true) == -15 |
51 | | - @test stirlings1(6, 6) == 1 |
52 | | - @test stirlings1(6, 6, true) == 1 |
53 | | - @test sum([abs(stirlings1(8, i, true)) for i = 0:8]) == factorial(8) |
54 | | - @test stirlings1(big"26", 10) == 196928100451110820242880 |
| 35 | + # stirlings1 |
| 36 | + @test_throws DomainError stirlings1(-1, 1) |
| 37 | + @test typeof(stirlings1(6, 2)) == Int |
| 38 | + @test stirlings1(0, 0) == 1 |
| 39 | + @test stirlings1(1, 1) == 1 |
| 40 | + @test stirlings1(2, 6) == 0 |
| 41 | + @test stirlings1(6, 0) == 0 |
| 42 | + @test stirlings1(6, 0, true) == 0 |
| 43 | + @test stirlings1(6, 1) == 120 |
| 44 | + @test stirlings1(6, 1, true) == -120 |
| 45 | + @test stirlings1(6, 2) == 274 |
| 46 | + @test stirlings1(6, 2, true) == 274 |
| 47 | + @test stirlings1(6, 3) == 225 |
| 48 | + @test stirlings1(6, 3, true) == -225 |
| 49 | + @test stirlings1(6, 4) == 85 |
| 50 | + @test stirlings1(6, 4, true) == 85 |
| 51 | + @test stirlings1(6, 5) == 15 |
| 52 | + @test stirlings1(6, 5, true) == -15 |
| 53 | + @test stirlings1(6, 6) == 1 |
| 54 | + @test stirlings1(6, 6, true) == 1 |
| 55 | + @test sum([abs(stirlings1(8, i, true)) for i in 0:8]) == factorial(8) |
| 56 | + @test stirlings1(big"26", 10) == 196928100451110820242880 |
55 | 57 |
|
56 | | - # stirlings2 |
57 | | - @test_throws DomainError stirlings2(-1, 1) |
58 | | - @test typeof(stirlings2(6, 2)) == Int |
59 | | - @test stirlings2(0, 0) == 1 |
60 | | - @test stirlings2(1, 1) == 1 |
61 | | - @test stirlings2(2, 6) == 0 |
62 | | - @test stirlings2(6, 0) == 0 |
63 | | - @test stirlings2(6, 1) == 1 |
64 | | - @test stirlings2(6, 2) == 31 |
65 | | - @test stirlings2(6, 3) == 90 |
66 | | - @test stirlings2(6, 4) == 65 |
67 | | - @test stirlings2(6, 5) == 15 |
68 | | - @test stirlings2(6, 6) == 1 |
69 | | - @test stirlings2(big"26", 10) == 13199555372846848005 |
| 58 | + # stirlings2 |
| 59 | + @test_throws DomainError stirlings2(-1, 1) |
| 60 | + @test typeof(stirlings2(6, 2)) == Int |
| 61 | + @test stirlings2(0, 0) == 1 |
| 62 | + @test stirlings2(1, 1) == 1 |
| 63 | + @test stirlings2(2, 6) == 0 |
| 64 | + @test stirlings2(6, 0) == 0 |
| 65 | + @test stirlings2(6, 1) == 1 |
| 66 | + @test stirlings2(6, 2) == 31 |
| 67 | + @test stirlings2(6, 3) == 90 |
| 68 | + @test stirlings2(6, 4) == 65 |
| 69 | + @test stirlings2(6, 5) == 15 |
| 70 | + @test stirlings2(6, 6) == 1 |
| 71 | + @test stirlings2(big"26", 10) == 13199555372846848005 |
70 | 72 |
|
71 | | - # bell |
72 | | - @test bellnum.(0:10) == [ |
73 | | - 1 |
74 | | - 1 |
75 | | - 2 |
76 | | - 5 |
77 | | - 15 |
78 | | - 52 |
79 | | - 203 |
80 | | - 877 |
| 73 | + # bell |
| 74 | + @test bellnum.(0:10) == [ |
| 75 | + 1 |
| 76 | + 1 |
| 77 | + 2 |
| 78 | + 5 |
| 79 | + 15 |
| 80 | + 52 |
| 81 | + 203 |
| 82 | + 877 |
81 | 83 | 4140 |
82 | | - 21147 |
83 | | - 115975 |
84 | | - ] |
85 | | - |
86 | | - @test bellnum(42) == parse(BigInt, "35742549198872617291353508656626642567") |
87 | | - @test_throws DomainError(-1) bellnum(-1) |
| 84 | + 21147 |
| 85 | + 115975 |
| 86 | + ] |
88 | 87 |
|
| 88 | + @test bellnum(42) == parse(BigInt, "35742549198872617291353508656626642567") |
| 89 | + @test_throws DomainError(-1) bellnum(-1) |
89 | 90 | end |
0 commit comments