Skip to content

Commit 310b7bf

Browse files
committed
Added specs for FunctionSymbol
1 parent e38cf80 commit 310b7bf

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

spec/function_symbol_spec.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
describe SymEngine::FunctionSymbol do
2+
3+
let(:x) { sym('x') }
4+
let(:y) { sym('y') }
5+
let(:z) { sym('z') }
6+
7+
describe '.new' do
8+
context 'with symbols' do
9+
subject { SymEngine::FunctionSymbol.new('f', x, y, z) }
10+
it { is_expected.to be_a SymEngine::FunctionSymbol }
11+
end
12+
13+
context 'with compound arguments' do
14+
subject { SymEngine::FunctionSymbol.new('f', 2*x, y, SymEngine::sin(z)) }
15+
it { is_expected.to be_a SymEngine::FunctionSymbol }
16+
end
17+
end
18+
19+
context '#diff' do
20+
let(:fun) { (SymEngine::FunctionSymbol.new('f', 2*x, y, SymEngine::sin(z))) }
21+
context 'by variable' do
22+
subject { fun.diff(x)/2 }
23+
it { is_expected.to be_a SymEngine::Subs }
24+
end
25+
26+
context 'by constant' do
27+
subject { fun.diff(2) }
28+
it { is_expected.to be_nil }
29+
end
30+
end
31+
end
32+
33+

0 commit comments

Comments
 (0)