Skip to content

Commit 719470c

Browse files
committed
Tests Done
1 parent 94614ce commit 719470c

File tree

1 file changed

+82
-0
lines changed

1 file changed

+82
-0
lines changed

spec/ntheory_spec.rb

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
require 'spec_helper'
2+
3+
describe SymEngine do
4+
before :each do
5+
end
6+
7+
describe 'NTheory' do
8+
9+
describe '#gcd' do
10+
context 'GCD of 2 and 4' do
11+
it 'returns 2' do
12+
f = SymEngine::gcd(2, 4)
13+
expect(f).to eql(2)
14+
end
15+
end
16+
end
17+
18+
describe '#lcm' do
19+
context 'LCM of 2 and 4' do
20+
it 'returns 4' do
21+
f = SymEngine::lcm(2, 4)
22+
expect(f).to eql(4)
23+
end
24+
end
25+
end
26+
27+
describe '#nextprime' do
28+
context 'NextPrime after 4' do
29+
it 'returns 5' do
30+
f = SymEngine::nextprime(4)
31+
expect(f).to eql(5)
32+
end
33+
end
34+
end
35+
36+
describe '#mod' do
37+
context '5 mod 4' do
38+
it 'returns 1' do
39+
f = SymEngine::mod(5, 4)
40+
expect(f).to eql(1)
41+
end
42+
end
43+
end
44+
45+
describe '#quotient' do
46+
context 'quotient of 5 divided by 2' do
47+
it 'returns 2' do
48+
f = SymEngine::quotient(5, 2)
49+
expect(f).to eql(2)
50+
end
51+
end
52+
end
53+
54+
describe '#fibonacci' do
55+
context '5th Fibonacci Number' do
56+
it 'returns 5' do
57+
f = SymEngine::fibonacci(5)
58+
expect(f).to eql(5)
59+
end
60+
end
61+
end
62+
63+
describe '#lucas' do
64+
context '1st Lucas Number' do
65+
it 'returns 1' do
66+
f = SymEngine::fibonacci(1)
67+
expect(f).to eql(1)
68+
end
69+
end
70+
end
71+
72+
describe '#binomial' do
73+
context 'binomial (n=5, k=1)' do
74+
it 'returns 5' do
75+
f = SymEngine::binomial(5, 1)
76+
expect(f).to eql(5)
77+
end
78+
end
79+
end
80+
81+
end
82+
end

0 commit comments

Comments
 (0)