danica 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42d3abe8f4cb30ba5f39df22450aa6b258897516
4
- data.tar.gz: 556b8f2d44f534d97bbce6d4e0a9d8cfbe9b1af2
3
+ metadata.gz: 88c93cc9b46fa1f9ced587a49535bc0eeec427cc
4
+ data.tar.gz: af6ae43ee59d5b15f204203f2a56c6978fec5125
5
5
  SHA512:
6
- metadata.gz: 6357c1036ab3949b292e94c0835b99812d7eaaeb426372c75e41cf6145b274592c821935e86dffd957b13c193e9875b6caf0824e8de8db862455d09f6f14d443
7
- data.tar.gz: df8178314d284efe3d623e40d3c974e5876dfcad6e0a703d5e57d925d2ce8f5ed01ed099618a46195cca08584a2acae35e3724221e79431f8a8d5eb373054b37
6
+ metadata.gz: a547b35c6f1d7c14534ab87ee7d1c6a08222cdcbbb166f435276355a99decfe0bcc458e4aef8e4a011ec79203363fc3fc4f8aa22d80cea260c45c45aedd9ce8f
7
+ data.tar.gz: 7c168e661e244debbd6e7c68ca0b3acadebb59cc9f9920ce76f6b632ba7c16e6eb102a70259970887477469bbda3cb23a02ef71a3a605e02ef2c902f0880394e
data/lib/danica/common.rb CHANGED
@@ -6,21 +6,43 @@ module Danica
6
6
 
7
7
  class << self
8
8
  def default_value(name, value)
9
- define_method(name) { value }
9
+ define_method(name) { |*_| value }
10
10
  end
11
11
  end
12
+
13
+ default_value :constant?, false
14
+ default_value :signaled?, false
12
15
  end
13
16
 
14
17
  def to_f
15
- raise 'Not IMplemented yet'
18
+ raise Exception::NotImplemented
19
+ end
20
+
21
+ def to_tex
22
+ to(:tex)
23
+ end
24
+
25
+ def to_gnu
26
+ to(:gnu)
16
27
  end
17
-
28
+
29
+ def to(format)
30
+ case format.to_sym
31
+ when :tex
32
+ to_tex
33
+ when :gnu
34
+ to_gnu
35
+ else
36
+ raise Exception::FormatNotFound.new
37
+ end
38
+ end
39
+
18
40
  def valued?
19
41
  to_f.present?
20
42
  rescue Exception::NotDefined
21
43
  false
22
44
  end
23
-
45
+
24
46
  private
25
47
 
26
48
  def wrap_as_group(value)
data/lib/danica/dsl.rb CHANGED
@@ -35,4 +35,5 @@ module Danica
35
35
  DSL.register_wrapper :num, :Number
36
36
  DSL.register_operator :sum, :Addition
37
37
  DSL.register_operator :product, :Multiplication
38
+ DSL.register_operator :sqrt, :SquaredRoot
38
39
  end
@@ -1,4 +1,6 @@
1
1
  class Danica::Exception < ::Exception
2
- class Danica::Exception::NotDefined < self; end
2
+ class NotDefined < self; end
3
+ class FormatNotFound < self; end
4
+ class NotImplemented < self; end
3
5
  end
4
6
 
@@ -3,12 +3,12 @@ module Danica
3
3
  include Common
4
4
  include VariablesHolder
5
5
  include DSL
6
-
6
+
7
7
  attr_accessor :name
8
8
 
9
9
  default_value :priority, 3
10
10
  default_value :is_grouped?, false
11
- delegate :to_f, :to_tex, :to_gnu, to: :function_block
11
+ delegate :to_f, :to, to: :function_block
12
12
 
13
13
  def self.build(*vars, &block)
14
14
  Class.new(self) do
@@ -48,14 +48,28 @@ module Danica
48
48
  self.class.new(vars_map).to_f
49
49
  end
50
50
 
51
+ def describe(format)
52
+ "#{name}(#{description_variables(format)}) = #{to(format)}"
53
+ end
54
+
51
55
  def describe_tex
52
- "#{name}(#{variables.reject(&:valued?).map(&:to_tex).join(', ')}) = #{to_tex}"
56
+ describe(:tex)
53
57
  end
54
58
 
55
59
  def describe_gnu
56
- "#{name}(#{variables.reject(&:valued?).map(&:to_gnu).join(', ')}) = #{to_gnu}"
60
+ describe(:gnu)
57
61
  end
58
62
 
59
63
  autoload :Gauss, 'danica/function/gauss'
64
+
65
+ private
66
+
67
+ def description_variables(format)
68
+ non_constant_variables.map { |v| v.to(format) }.join(', ')
69
+ end
70
+
71
+ def non_constant_variables
72
+ variables.reject(&:constant?)
73
+ end
60
74
  end
61
75
  end
@@ -1,35 +1,21 @@
1
1
  module Danica
2
- class Function::Gauss < Function.build(:x, average: { latex: '\mu', gnu: :u }, variance_root: { latex: '\sigma', gnu: :v }) { multiplication(elements) }
2
+ class Function::Gauss < Function.build(:x, average: { latex: '\mu', gnu: :u }, variance_root: { latex: '\sigma', gnu: :v }) { num(1) / denominator * exponential(exp) }
3
3
 
4
4
  private
5
5
 
6
- def elements
7
- [
8
- division(1, denominator),
9
- exponential(exp)
10
- ]
11
- end
12
-
13
6
  def denominator
14
- variance_root *
15
- squared_root(
16
- multiplication(2, PI),
17
- )
7
+ variance_root * sqrt(num(2) * PI)
18
8
  end
19
9
 
20
10
  def exp
21
- negative(
22
- division(
23
- power(group(
24
- addition(x, negative(average))
25
- ), 2),
26
- multiplication(2, variance)
27
- )
11
+ - (
12
+ ((x - average) ** 2) /
13
+ (num(2) * variance)
28
14
  )
29
15
  end
30
16
 
31
17
  def variance
32
- @variance ||= power(variance_root, 2)
18
+ @variance ||= variance_root ** 2
33
19
  end
34
20
  end
35
21
  end
@@ -6,7 +6,7 @@ module Danica
6
6
 
7
7
  default_value :priority, 3
8
8
  default_value :is_grouped?, false
9
-
9
+
10
10
  def initialize(*args)
11
11
  self.variables = args.flatten
12
12
  end
@@ -8,19 +8,15 @@ module Danica
8
8
 
9
9
  private
10
10
 
11
- def tex_symbol
12
- '+'
13
- end
11
+ default_value :symbol, :+
14
12
 
15
13
  def chain_operation(a, b)
16
14
  a + b
17
15
  end
18
16
 
19
- alias_method :gnu_symbol, :tex_symbol
20
-
21
17
  def join_proc(symbol)
22
18
  proc do |_, value|
23
- value.is_a?(Wrapper::Negative) || value.is_a?(Wrapper::PlusMinus) ? ' ' : " #{symbol} "
19
+ value.signaled? ? ' ' : " #{symbol} "
24
20
  end
25
21
  end
26
22
  end
@@ -16,20 +16,20 @@ module Danica
16
16
  variables.include?(value)
17
17
  end
18
18
 
19
- def to_tex
20
- to_string(:tex)
21
- end
22
-
23
- def to_gnu
24
- to_string(:gnu)
19
+ def to(format)
20
+ extractor = string_extractor(format)
21
+ variables.procedural_join(extractor, &join_proc(symbol(format)))
25
22
  end
26
23
 
27
24
  private
28
25
 
29
- def to_string(type)
30
- extractor = string_extractor("to_#{type}")
31
- symbol = { tex: tex_symbol, gnu: gnu_symbol }[type]
32
- variables.procedural_join(extractor, &join_proc(symbol))
26
+ def symbol(format)
27
+ case format.to_sym
28
+ when :tex
29
+ tex_symbol
30
+ when :gnu
31
+ gnu_symbol
32
+ end
33
33
  end
34
34
 
35
35
  def join_proc(symbol)
@@ -39,7 +39,7 @@ module Danica
39
39
  def string_extractor(method)
40
40
  proc do |parcel|
41
41
  parcel = wrap_as_group(parcel)
42
- parcel.public_send(method)
42
+ parcel.to(method)
43
43
  end
44
44
  end
45
45
 
@@ -8,13 +8,8 @@ module Danica
8
8
 
9
9
  private
10
10
 
11
- def tex_symbol
12
- '\cdot'
13
- end
14
-
15
- def gnu_symbol
16
- '*'
17
- end
11
+ default_value :tex_symbol, '\cdot'
12
+ default_value :gnu_symbol, :*
18
13
 
19
14
  def chain_operation(a, b)
20
15
  a * b
@@ -27,7 +27,7 @@ module Danica
27
27
  def variables
28
28
  variables_hash.values
29
29
  end
30
-
30
+
31
31
  def variables_hash
32
32
  @variables_hash ||= {}.merge(self.class.variables_hash)
33
33
  end
@@ -37,11 +37,5 @@ module Danica
37
37
  var.try(:value)
38
38
  end.as_hash(self.class.variables_names)
39
39
  end
40
-
41
- private
42
-
43
- def non_valued_variables
44
- variables.reject(&:valued?)
45
- end
46
40
  end
47
41
  end
@@ -1,3 +1,3 @@
1
1
  module Danica
2
- VERSION = '2.4.2'
2
+ VERSION = '2.4.3'
3
3
  end
@@ -8,6 +8,7 @@ module Danica
8
8
  default_value :priority, 10
9
9
  default_value :valued?, true
10
10
  default_value :is_grouped?, false
11
+ default_value :constant?, true
11
12
 
12
13
  def initialize(*args)
13
14
  attrs = args.extract_options!
@@ -7,7 +7,7 @@ module Danica
7
7
 
8
8
  default_value :priority, 10
9
9
  default_value :is_grouped?, true
10
-
10
+
11
11
  delegate :to_f, :valued?, to: :value
12
12
 
13
13
  def initialize(value)
@@ -8,7 +8,8 @@ module Danica
8
8
 
9
9
  default_value :priority, 2
10
10
  default_value :is_grouped?, false
11
-
11
+ default_value :signaled?, true
12
+
12
13
  delegate :valued?, to: :value
13
14
 
14
15
  def initialize(value)
@@ -19,12 +20,8 @@ module Danica
19
20
  -value.to_f
20
21
  end
21
22
 
22
- def to_tex
23
- "-#{wrap_as_group(value).to_tex}"
24
- end
25
-
26
- def to_gnu
27
- "-#{wrap_as_group(value).to_gnu}"
23
+ def to(format)
24
+ "-#{wrap_as_group(value).to(format)}"
28
25
  end
29
26
 
30
27
  def ==(other)
@@ -13,7 +13,7 @@ module Danica
13
13
  @value = value
14
14
  end
15
15
 
16
- def to_tex
16
+ def to(_)
17
17
  return value.to_i.to_s if value.to_i == value
18
18
  value.to_s
19
19
  end
@@ -22,12 +22,14 @@ module Danica
22
22
  value.present?
23
23
  end
24
24
 
25
+ def signaled?
26
+ value < 0
27
+ end
28
+
25
29
  def ==(other)
26
30
  return false unless other.class == self.class
27
31
  value == other.value
28
32
  end
29
-
30
- alias_method :to_gnu, :to_tex
31
33
  end
32
34
  end
33
35
 
@@ -8,7 +8,8 @@ module Danica
8
8
 
9
9
  default_value :priority, 2
10
10
  default_value :is_grouped?, false
11
-
11
+ default_value :signaled?, true
12
+
12
13
  delegate :valued?, to: :value
13
14
 
14
15
  def initialize(value)
@@ -8,19 +8,20 @@ describe 'integration of addition' do
8
8
  2,
9
9
  -3,
10
10
  4,
11
- Danica::Wrapper::PlusMinus.new(5)
11
+ Danica::Wrapper::PlusMinus.new(5),
12
+ Danica::Wrapper::Number.new(-6)
12
13
  )
13
14
  end
14
15
 
15
16
  describe '#to_gnu' do
16
17
  it 'returns the correct string' do
17
- expect(subject.to_gnu).to eq('-1 + 2 -3 + 4 + 5')
18
+ expect(subject.to_gnu).to eq('-1 + 2 -3 + 4 + 5 -6')
18
19
  end
19
20
  end
20
21
 
21
22
  describe '#to_tex' do
22
23
  it 'returns the correct string' do
23
- expect(subject.to_tex).to eq('-1 + 2 -3 + 4 \pm 5')
24
+ expect(subject.to_tex).to eq('-1 + 2 -3 + 4 \pm 5 -6')
24
25
  end
25
26
  end
26
27
  end
@@ -0,0 +1,88 @@
1
+ require 'spec_helper'
2
+
3
+ module Danica
4
+ module Common
5
+ class Dummy
6
+ include Common
7
+
8
+ def to_tex
9
+ 'tex'
10
+ end
11
+
12
+ def to_gnu
13
+ 'gnu'
14
+ end
15
+ end
16
+
17
+ class Dummy2
18
+ include Common
19
+
20
+ def to(format)
21
+ "formatted: #{format}"
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ describe Danica::Common do
28
+ let(:clazz) { described_class::Dummy }
29
+ subject { clazz.new }
30
+
31
+ describe '#to_f' do
32
+ it do
33
+ expect do
34
+ subject.to_f
35
+ end.to raise_error(Danica::Exception::NotImplemented)
36
+ end
37
+ end
38
+
39
+ describe '#to' do
40
+ context 'when defining to_tex and to_gnu' do
41
+ context 'when requesting :tex' do
42
+ it 'has a string for latex' do
43
+ expect(subject.to(:tex)).to eq('tex')
44
+ end
45
+ end
46
+ context "when requesting 'tex'" do
47
+ it 'has a string for latex' do
48
+ expect(subject.to('tex')).to eq('tex')
49
+ end
50
+ end
51
+ context 'when requesting :gnu' do
52
+ it 'has a string for gnu' do
53
+ expect(subject.to(:gnu)).to eq('gnu')
54
+ end
55
+ end
56
+ context "when requesting 'gnu'" do
57
+ it 'has a string for gnu' do
58
+ expect(subject.to('gnu')).to eq('gnu')
59
+ end
60
+ end
61
+ context "when requesting wrong format" do
62
+ it do
63
+ expect do
64
+ subject.to('format')
65
+ end.to raise_error(Danica::Exception::FormatNotFound)
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ describe '#to_tex' do
72
+ context 'when defined the #to method' do
73
+ let(:clazz) { described_class::Dummy2 }
74
+ it 'returns the call of #to(:tex)' do
75
+ expect(subject.to_tex).to eq('formatted: tex')
76
+ end
77
+ end
78
+ end
79
+
80
+ describe '#to_gnu' do
81
+ context 'when defined the #to method' do
82
+ let(:clazz) { described_class::Dummy2 }
83
+ it 'returns the call of #to(:gnu)' do
84
+ expect(subject.to_gnu).to eq('formatted: gnu')
85
+ end
86
+ end
87
+ end
88
+ end
@@ -23,6 +23,7 @@ shared_context 'a class with mapped dsl' do
23
23
  end
24
24
  {
25
25
  squared_root: Danica::Operator::SquaredRoot,
26
+ sqrt: Danica::Operator::SquaredRoot,
26
27
  exponential: Danica::Operator::Exponential,
27
28
  sin: Danica::Operator::Sin,
28
29
  cos: Danica::Operator::Cos,
@@ -126,9 +126,39 @@ describe Danica::Function do
126
126
  function_class.new(name: :f, x: Danica::PI)
127
127
  end
128
128
 
129
- it do
129
+ it 'ignores the constant in the definition' do
130
130
  expect(function.describe_tex).to eq('f(y) = \pi^{y}')
131
131
  end
132
+
133
+ context 'from a hash' do
134
+ let(:function) do
135
+ function_class.new(name: :f, x: { latex: '\pi', gnu: 'pi', value: 3.14 })
136
+ end
137
+
138
+ it 'ignores the constant in the definition' do
139
+ expect(function.describe_tex).to eq('f(y) = \pi^{y}')
140
+ end
141
+ end
142
+ end
143
+
144
+ context 'when a variable is a number' do
145
+ let(:function) do
146
+ function_class.new(name: :f, x: 2)
147
+ end
148
+
149
+ it 'sohws the variable as number' do
150
+ expect(function.describe_tex).to eq('f(2, y) = 2^{y}')
151
+ end
152
+ end
153
+
154
+ context 'when a variable has value' do
155
+ let(:function) do
156
+ function_class.new(name: :f, x: 2)
157
+ end
158
+
159
+ it 'sohws the variable as number' do
160
+ expect(function.describe_tex).to eq('f(2, y) = 2^{y}')
161
+ end
132
162
  end
133
163
  end
134
164
 
@@ -148,9 +178,39 @@ describe Danica::Function do
148
178
  function_class.new(name: :f, x: Danica::PI)
149
179
  end
150
180
 
151
- it do
181
+ it 'ignores the constant in the definition' do
152
182
  expect(function.describe_gnu).to eq('f(y) = pi**(y)')
153
183
  end
184
+
185
+ context 'from a hash' do
186
+ let(:function) do
187
+ function_class.new(name: :f, x: { latex: '\pi', gnu: 'pi', value: 3.14 })
188
+ end
189
+
190
+ it 'ignores the constant in the definition' do
191
+ expect(function.describe_gnu).to eq('f(y) = pi**(y)')
192
+ end
193
+ end
194
+ end
195
+
196
+ context 'when a variable has value' do
197
+ let(:function) do
198
+ function_class.new(name: :f, x: { name: :x, value: 2 })
199
+ end
200
+
201
+ it 'sohws the variable as number' do
202
+ expect(function.describe_gnu).to eq('f(2, y) = 2**(y)')
203
+ end
204
+ end
205
+
206
+ context 'when a variable is a number' do
207
+ let(:function) do
208
+ function_class.new(name: :f, x: 2)
209
+ end
210
+
211
+ it 'sohws the variable as number' do
212
+ expect(function.describe_gnu).to eq('f(2, y) = 2**(y)')
213
+ end
154
214
  end
155
215
  end
156
216
 
@@ -30,12 +30,12 @@ describe Danica::Operator::Addition do
30
30
  it_behaves_like 'a operator that joins many variables with same operation', {
31
31
  calculated: 10,
32
32
  numeric_variables: [ 1.5, 3.0, 3.5 ],
33
- to_tex: {
33
+ tex: {
34
34
  string_expected: 'X1 + X2 + X3 + X4',
35
35
  integer_expected: '1.5 + 3 + X3 + X4',
36
36
  float_expected: '1.5 + 3 + 3.5 + X4'
37
37
  },
38
- to_gnu: {
38
+ gnu: {
39
39
  string_expected: 'X1 + X2 + X3 + X4',
40
40
  integer_expected: '1.5 + 3 + X3 + X4',
41
41
  float_expected: '1.5 + 3 + 3.5 + X4'
@@ -27,12 +27,12 @@ describe Danica::Operator::Multiplication do
27
27
  it_behaves_like 'a operator that joins many variables with same operation', {
28
28
  calculated: 24,
29
29
  numeric_variables: [ 1.5, 2, 3.5 ],
30
- to_tex: {
30
+ tex: {
31
31
  string_expected: %w(X1 X2 X3 X4).join(' \cdot '),
32
32
  integer_expected: %w(1.5 2 X3 X4).join(' \cdot '),
33
33
  float_expected: %w(1.5 2 3.5 X4).join(' \cdot ')
34
34
  },
35
- to_gnu: {
35
+ gnu: {
36
36
  string_expected: %w(X1 X2 X3 X4).join(' * '),
37
37
  integer_expected: %w(1.5 2 X3 X4).join(' * '),
38
38
  float_expected: %w(1.5 2 3.5 X4).join(' * '),
@@ -129,7 +129,7 @@ describe Danica::VariablesHolder do
129
129
  end
130
130
  end
131
131
  end
132
-
132
+
133
133
  describe '#variables_value_hash' do
134
134
  context 'when instance has no variables defined' do
135
135
  it 'returns the default value' do
@@ -19,6 +19,36 @@ describe Danica::Wrapper::Constant do
19
19
  end
20
20
  end
21
21
 
22
+ describe '#to' do
23
+ context 'when requesting :tex' do
24
+ it 'has a string for latex' do
25
+ expect(subject.to(:tex)).to eq('M')
26
+ end
27
+ end
28
+ context "when requesting 'tex'" do
29
+ it 'has a string for latex' do
30
+ expect(subject.to('tex')).to eq('M')
31
+ end
32
+ end
33
+ context 'when requesting :gnu' do
34
+ it 'has a string for gnu' do
35
+ expect(subject.to(:gnu)).to eq('m')
36
+ end
37
+ end
38
+ context "when requesting 'gnu'" do
39
+ it 'has a string for gnu' do
40
+ expect(subject.to('gnu')).to eq('m')
41
+ end
42
+ end
43
+ context "when requesting wrong format" do
44
+ it do
45
+ expect do
46
+ subject.to('format')
47
+ end.to raise_error(Danica::Exception::FormatNotFound)
48
+ end
49
+ end
50
+ end
51
+
22
52
  describe '#to_gnu' do
23
53
  it 'has a string for gnu' do
24
54
  expect(subject.to_gnu).to eq('m')
@@ -8,6 +8,16 @@ describe Danica::Wrapper::Number do
8
8
 
9
9
  it_behaves_like 'an object with basic operation'
10
10
 
11
+ describe '#valued?' do
12
+ context 'when value is present' do
13
+ it { expect(subject.valued?).to be_truthy }
14
+ end
15
+ context 'when value is not present' do
16
+ let(:value) { false }
17
+ it { expect(subject.valued?).to be_falsey }
18
+ end
19
+ end
20
+
11
21
  describe '#to_f' do
12
22
  it 'returns the float of value' do
13
23
  expect(subject.to_f).to eq(10)
@@ -38,26 +38,26 @@ shared_examples 'a operator that knows how to calculate' do |arguments|
38
38
  end
39
39
 
40
40
  shared_examples 'a operator that knows how to write to tex' do |arguments|
41
- it_behaves_like 'a operator that knows how to write to a string', :to_tex, arguments
41
+ it_behaves_like 'a operator that knows how to write to a string', :tex, arguments
42
42
  end
43
43
 
44
44
  shared_examples 'a operator that knows how to write to gnu' do |arguments|
45
- it_behaves_like 'a operator that knows how to write to a string', :to_gnu, arguments
45
+ it_behaves_like 'a operator that knows how to write to a string', :gnu, arguments
46
46
  end
47
47
 
48
- shared_examples 'a operator that knows how to write to a string' do |command, arguments|
48
+ shared_examples 'a operator that knows how to write to a string' do |format, arguments|
49
49
  let(:numeric_variables) { arguments[:numeric_variables] }
50
- include_context 'variables are initialized', arguments[command], *%w(integer_expected string_expected float_expected)
50
+ include_context 'variables are initialized', arguments[format], *%w(integer_expected string_expected float_expected)
51
51
  subject { described_class.new(*variables) }
52
52
 
53
- describe "#{command}" do
53
+ describe "#to(#{format})" do
54
54
  let(:variables) do
55
55
  (1..4).map { |i| "X#{i}" }
56
56
  end
57
57
 
58
58
  context 'when variables have no value' do
59
59
  it 'outputs a text format' do
60
- expect(subject.public_send(command)).to eq(string_expected)
60
+ expect(subject.to(format)).to eq(string_expected)
61
61
  end
62
62
  end
63
63
 
@@ -70,14 +70,14 @@ shared_examples 'a operator that knows how to write to a string' do |command, ar
70
70
  end
71
71
 
72
72
  it 'outputs a latex format with colapsed numbers' do
73
- expect(subject.public_send(command)).to eq(integer_expected)
73
+ expect(subject.to(format)).to eq(integer_expected)
74
74
  end
75
75
 
76
76
  context 'when numeric variables calculated is a float value' do
77
77
  let(:numeric_variables_index) { 2 }
78
78
 
79
79
  it 'outputs a text format with colapsed numbers' do
80
- expect(subject.public_send(command)).to eq(float_expected)
80
+ expect(subject.to(format)).to eq(float_expected)
81
81
  end
82
82
  end
83
83
  end
@@ -91,14 +91,14 @@ shared_examples 'a operator that knows how to write to a string' do |command, ar
91
91
  end
92
92
 
93
93
  it 'outputs a text format of numbers' do
94
- expect(subject.public_send(command)).to eq(integer_expected)
94
+ expect(subject.to(format)).to eq(integer_expected)
95
95
  end
96
96
 
97
97
  context 'when numeric variables are a float value' do
98
98
  let(:numeric_variables_index) { 2 }
99
99
 
100
100
  it 'outputs a text format of numbers' do
101
- expect(subject.public_send(command)).to eq(float_expected)
101
+ expect(subject.to(format)).to eq(float_expected)
102
102
  end
103
103
  end
104
104
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danica
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darthjee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-12 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -172,6 +172,7 @@ files:
172
172
  - spec/integration/negative_spec.rb
173
173
  - spec/integration/plus_minus_spec.rb
174
174
  - spec/integration/power_spec.rb
175
+ - spec/lib/danica/common_spec.rb
175
176
  - spec/lib/danica/dsl_spec.rb
176
177
  - spec/lib/danica/function/gauss_spec.rb
177
178
  - spec/lib/danica/function_spec.rb
@@ -233,6 +234,7 @@ test_files:
233
234
  - spec/integration/negative_spec.rb
234
235
  - spec/integration/plus_minus_spec.rb
235
236
  - spec/integration/power_spec.rb
237
+ - spec/lib/danica/common_spec.rb
236
238
  - spec/lib/danica/dsl_spec.rb
237
239
  - spec/lib/danica/function/gauss_spec.rb
238
240
  - spec/lib/danica/function_spec.rb