danica 2.0.4 → 2.0.5
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 +4 -4
 - data/README.md +6 -6
 - data/lib/danica/common.rb +0 -20
 - data/lib/danica/cos.rb +2 -4
 - data/lib/danica/division.rb +2 -4
 - data/lib/danica/exponential.rb +2 -4
 - data/lib/danica/group.rb +4 -2
 - data/lib/danica/operator/chained.rb +8 -21
 - data/lib/danica/power.rb +2 -4
 - data/lib/danica/sin.rb +2 -4
 - data/lib/danica/squared_root.rb +2 -4
 - data/lib/danica/sum.rb +2 -4
 - data/lib/danica/version.rb +1 -1
 - data/spec/lib/danica/cos_spec.rb +2 -1
 - data/spec/lib/danica/division_spec.rb +2 -2
 - data/spec/lib/danica/exponential_spec.rb +2 -1
 - data/spec/lib/danica/function_spec.rb +2 -2
 - data/spec/lib/danica/power_spec.rb +2 -2
 - data/spec/lib/danica/product_spec.rb +4 -4
 - data/spec/lib/danica/sin_spec.rb +2 -1
 - data/spec/lib/danica/squared_root_spec.rb +2 -1
 - data/spec/lib/danica/sum_spec.rb +5 -5
 - data/spec/support/shared_examples/operator/chained.rb +3 -3
 - data/spec/support/shared_examples/operator/dual_term.rb +1 -1
 - data/spec/support/shared_examples/operator/single_input.rb +3 -3
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d9452b255fbf76168b5420387cfc63e578f61e2d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 52e4a1dc89abe24a06b337d6fee11a09670455d4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8e703c6ebbecb67468d686145e91546209a1330c68e2f02992313b7255ea6439970fdd817addaa00e0f88e9bf6cece0fdb00ce0c1ea7c9e99d383ac3b48c4fef
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3e495695b72e62546b941d7a6838657574dbd54bc94044177dd90c39a77dbad1170cac77ccea7be96eaa9843145f68789f3e0b2c7e543db50dc86320ea873f05
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -41,12 +41,12 @@ class MyOperator < Danica::Operator 
     | 
|
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
              private
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
              def  
     | 
| 
       45 
     | 
    
         
            -
                #implement  
     | 
| 
      
 44 
     | 
    
         
            +
              def to_tex
         
     | 
| 
      
 45 
     | 
    
         
            +
                #implement to_tex here
         
     | 
| 
       46 
46 
     | 
    
         
             
              end
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
              def  
     | 
| 
       49 
     | 
    
         
            -
                #implement  
     | 
| 
      
 48 
     | 
    
         
            +
              def to_gnu
         
     | 
| 
      
 49 
     | 
    
         
            +
                #implement to_gnu here
         
     | 
| 
       50 
50 
     | 
    
         
             
              end
         
     | 
| 
       51 
51 
     | 
    
         
             
            end
         
     | 
| 
       52 
52 
     | 
    
         
             
            ```
         
     | 
| 
         @@ -61,11 +61,11 @@ class Danica::Inverse 
     | 
|
| 
       61 
61 
     | 
    
         | 
| 
       62 
62 
     | 
    
         
             
              private
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
              def  
     | 
| 
      
 64 
     | 
    
         
            +
              def to_tex
         
     | 
| 
       65 
65 
     | 
    
         
             
                "(#{value.to_tex})^{-1}"
         
     | 
| 
       66 
66 
     | 
    
         
             
              end
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
              def  
     | 
| 
      
 68 
     | 
    
         
            +
              def to_gnu
         
     | 
| 
       69 
69 
     | 
    
         
             
                "(#{value.to_gnu}) ** -1"
         
     | 
| 
       70 
70 
     | 
    
         
             
              end
         
     | 
| 
       71 
71 
     | 
    
         
             
            end
         
     | 
    
        data/lib/danica/common.rb
    CHANGED
    
    | 
         @@ -10,18 +10,6 @@ module Danica 
     | 
|
| 
       10 
10 
     | 
    
         
             
                  raise 'Not IMplemented yet'
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                def to_tex
         
     | 
| 
       14 
     | 
    
         
            -
                  Number.new(to_f).to_tex
         
     | 
| 
       15 
     | 
    
         
            -
                rescue Exception::NotDefined
         
     | 
| 
       16 
     | 
    
         
            -
                  tex_string
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                def to_gnu
         
     | 
| 
       20 
     | 
    
         
            -
                  Number.new(to_f).to_gnu
         
     | 
| 
       21 
     | 
    
         
            -
                rescue Exception::NotDefined
         
     | 
| 
       22 
     | 
    
         
            -
                  gnu_string
         
     | 
| 
       23 
     | 
    
         
            -
                end
         
     | 
| 
       24 
     | 
    
         
            -
              
         
     | 
| 
       25 
13 
     | 
    
         
             
                def variables=(variables)
         
     | 
| 
       26 
14 
     | 
    
         
             
                  @variables = variables.map { |v| wrap_value(v) }
         
     | 
| 
       27 
15 
     | 
    
         
             
                end
         
     | 
| 
         @@ -49,14 +37,6 @@ module Danica 
     | 
|
| 
       49 
37 
     | 
    
         
             
                def non_valued_variables
         
     | 
| 
       50 
38 
     | 
    
         
             
                  variables.reject(&:valued?)
         
     | 
| 
       51 
39 
     | 
    
         
             
                end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
                def tex_string
         
     | 
| 
       54 
     | 
    
         
            -
                  raise 'Not IMplemented yet'
         
     | 
| 
       55 
     | 
    
         
            -
                end
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                def gnu_string
         
     | 
| 
       58 
     | 
    
         
            -
                  raise 'Not IMplemented yet'
         
     | 
| 
       59 
     | 
    
         
            -
                end
         
     | 
| 
       60 
40 
     | 
    
         | 
| 
       61 
41 
     | 
    
         
             
                def wrap_value(value)
         
     | 
| 
       62 
42 
     | 
    
         
             
                  return Number.new(value) if value.is_a?(Numeric)
         
     | 
    
        data/lib/danica/cos.rb
    CHANGED
    
    
    
        data/lib/danica/division.rb
    CHANGED
    
    | 
         @@ -6,13 +6,11 @@ module Danica 
     | 
|
| 
       6 
6 
     | 
    
         
             
                  numerator.to_f / denominator.to_f
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                def tex_string
         
     | 
| 
      
 9 
     | 
    
         
            +
                def to_tex
         
     | 
| 
       12 
10 
     | 
    
         
             
                  "\\frac{#{numerator.to_tex}}{#{denominator.to_tex}}"
         
     | 
| 
       13 
11 
     | 
    
         
             
                end
         
     | 
| 
       14 
12 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                def  
     | 
| 
      
 13 
     | 
    
         
            +
                def to_gnu
         
     | 
| 
       16 
14 
     | 
    
         
             
                  "#{numerator.to_gnu}/#{denominator.to_gnu}"
         
     | 
| 
       17 
15 
     | 
    
         
             
                end
         
     | 
| 
       18 
16 
     | 
    
         
             
              end
         
     | 
    
        data/lib/danica/exponential.rb
    CHANGED
    
    
    
        data/lib/danica/group.rb
    CHANGED
    
    
| 
         @@ -10,27 +10,19 @@ module Danica 
     | 
|
| 
       10 
10 
     | 
    
         
             
                    variables.include?(value)
         
     | 
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                   
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                  def repack(other)
         
     | 
| 
       16 
     | 
    
         
            -
                    other_variables = other.is_a?(self.class) ? other.variables : [ other ]
         
     | 
| 
       17 
     | 
    
         
            -
                    self.class.new(variables + other_variables)
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                  def tex_string
         
     | 
| 
       21 
     | 
    
         
            -
                    (numeric_to_tex + non_numeric_variables.map(&:to_tex)).join(" #{tex_symbol} ")
         
     | 
| 
      
 13 
     | 
    
         
            +
                  def to_tex
         
     | 
| 
      
 14 
     | 
    
         
            +
                    variables.map(&:to_tex).join(" #{tex_symbol} ")
         
     | 
| 
       22 
15 
     | 
    
         
             
                  end
         
     | 
| 
       23 
16 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  def  
     | 
| 
       25 
     | 
    
         
            -
                     
     | 
| 
      
 17 
     | 
    
         
            +
                  def to_gnu
         
     | 
| 
      
 18 
     | 
    
         
            +
                    variables.map(&:to_gnu).join(" #{gnu_symbol} ")
         
     | 
| 
       26 
19 
     | 
    
         
             
                  end
         
     | 
| 
       27 
20 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
                   
     | 
| 
       29 
     | 
    
         
            -
                    variables.select { |v| v.valued? }
         
     | 
| 
       30 
     | 
    
         
            -
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                  private
         
     | 
| 
       31 
22 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                  def  
     | 
| 
       33 
     | 
    
         
            -
                     
     | 
| 
      
 23 
     | 
    
         
            +
                  def repack(other)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    other_variables = other.is_a?(self.class) ? other.variables : [ other ]
         
     | 
| 
      
 25 
     | 
    
         
            +
                    self.class.new(variables + other_variables)
         
     | 
| 
       34 
26 
     | 
    
         
             
                  end
         
     | 
| 
       35 
27 
     | 
    
         | 
| 
       36 
28 
     | 
    
         
             
                  def chain(numbers)
         
     | 
| 
         @@ -38,11 +30,6 @@ module Danica 
     | 
|
| 
       38 
30 
     | 
    
         
             
                      chain_operation(a,b)
         
     | 
| 
       39 
31 
     | 
    
         
             
                    end.to_f
         
     | 
| 
       40 
32 
     | 
    
         
             
                  end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                  def numeric_to_tex
         
     | 
| 
       43 
     | 
    
         
            -
                    return [] if numeric_variables.empty?
         
     | 
| 
       44 
     | 
    
         
            -
                    [ Number.new(chain(numeric_variables.map(&:to_f))).to_tex ]
         
     | 
| 
       45 
     | 
    
         
            -
                  end
         
     | 
| 
       46 
33 
     | 
    
         
             
                end
         
     | 
| 
       47 
34 
     | 
    
         
             
              end
         
     | 
| 
       48 
35 
     | 
    
         
             
            end
         
     | 
    
        data/lib/danica/power.rb
    CHANGED
    
    
    
        data/lib/danica/sin.rb
    CHANGED
    
    
    
        data/lib/danica/squared_root.rb
    CHANGED
    
    
    
        data/lib/danica/sum.rb
    CHANGED
    
    
    
        data/lib/danica/version.rb
    CHANGED
    
    
    
        data/spec/lib/danica/cos_spec.rb
    CHANGED
    
    | 
         @@ -9,7 +9,8 @@ describe Danica::Cos do 
     | 
|
| 
       9 
9 
     | 
    
         
             
              it_behaves_like 'a operator with a single input value', {
         
     | 
| 
       10 
10 
     | 
    
         
             
                variable_value: Math::PI,
         
     | 
| 
       11 
11 
     | 
    
         
             
                expected_number: -1.0,
         
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
      
 12 
     | 
    
         
            +
                expected_number_tex: 'cos(3.141592653589793)',
         
     | 
| 
      
 13 
     | 
    
         
            +
                expected_number_gnu: 'cos(3.141592653589793)',
         
     | 
| 
       13 
14 
     | 
    
         
             
                expected_tex: 'cos(X)',
         
     | 
| 
       14 
15 
     | 
    
         
             
                expected_gnu: 'cos(X)'
         
     | 
| 
       15 
16 
     | 
    
         
             
              }
         
     | 
| 
         @@ -12,12 +12,12 @@ describe Danica::Division do 
     | 
|
| 
       12 
12 
     | 
    
         
             
                calculated: 1.0 / 2.0,
         
     | 
| 
       13 
13 
     | 
    
         
             
                to_tex: {
         
     | 
| 
       14 
14 
     | 
    
         
             
                  string_expected: '\frac{X1}{X2}',
         
     | 
| 
       15 
     | 
    
         
            -
                  numeric_string_expected: ' 
     | 
| 
      
 15 
     | 
    
         
            +
                  numeric_string_expected: '\frac{2}{4}',
         
     | 
| 
       16 
16 
     | 
    
         
             
                  partial_string_expected: '\frac{2}{X2}'
         
     | 
| 
       17 
17 
     | 
    
         
             
                },
         
     | 
| 
       18 
18 
     | 
    
         
             
                to_gnu: {
         
     | 
| 
       19 
19 
     | 
    
         
             
                  string_expected: 'X1/X2',
         
     | 
| 
       20 
     | 
    
         
            -
                  numeric_string_expected: ' 
     | 
| 
      
 20 
     | 
    
         
            +
                  numeric_string_expected: '2/4',
         
     | 
| 
       21 
21 
     | 
    
         
             
                  partial_string_expected: '2/X2'
         
     | 
| 
       22 
22 
     | 
    
         
             
                }
         
     | 
| 
       23 
23 
     | 
    
         
             
              }
         
     | 
| 
         @@ -9,7 +9,8 @@ describe Danica::Exponential do 
     | 
|
| 
       9 
9 
     | 
    
         
             
              it_behaves_like 'a operator with a single input value', {
         
     | 
| 
       10 
10 
     | 
    
         
             
                variable_value: 2,
         
     | 
| 
       11 
11 
     | 
    
         
             
                expected_number: Math.exp(2),
         
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
      
 12 
     | 
    
         
            +
                expected_number_tex: 'e^{2}',
         
     | 
| 
      
 13 
     | 
    
         
            +
                expected_number_gnu: 'exp(2)',
         
     | 
| 
       13 
14 
     | 
    
         
             
                expected_tex: 'e^{X}',
         
     | 
| 
       14 
15 
     | 
    
         
             
                expected_gnu: 'exp(X)'
         
     | 
| 
       15 
16 
     | 
    
         
             
              }
         
     | 
| 
         @@ -231,7 +231,7 @@ describe Danica::Function do 
     | 
|
| 
       231 
231 
     | 
    
         | 
| 
       232 
232 
     | 
    
         
             
                describe '#to_tex' do
         
     | 
| 
       233 
233 
     | 
    
         
             
                  context 'when creating the spatial operator for constantly accelerated movement' do
         
     | 
| 
       234 
     | 
    
         
            -
                    let(:expected) { '\frac{1}{\sqrt{ 
     | 
| 
      
 234 
     | 
    
         
            +
                    let(:expected) { '\frac{1}{\sqrt{2 \cdot \pi \cdot v^{2}}} \cdot e^{-\frac{\left(x + -u\right)^{2}}{2 \cdot v^{2}}}'  }
         
     | 
| 
       235 
235 
     | 
    
         | 
| 
       236 
236 
     | 
    
         
             
                    it 'return the latex format CAM' do
         
     | 
| 
       237 
237 
     | 
    
         
             
                      expect(subject.to_tex).to eq(expected)
         
     | 
| 
         @@ -241,7 +241,7 @@ describe Danica::Function do 
     | 
|
| 
       241 
241 
     | 
    
         | 
| 
       242 
242 
     | 
    
         
             
                describe '#to_gnu' do
         
     | 
| 
       243 
243 
     | 
    
         
             
                  context 'when creating the spatial operator for constantly accelerated movement' do
         
     | 
| 
       244 
     | 
    
         
            -
                    let(:expected) { '1/sqrt( 
     | 
| 
      
 244 
     | 
    
         
            +
                    let(:expected) { '1/sqrt(2 * pi * v**2) * exp(-(x + -u)**2/2 * v**2)' }
         
     | 
| 
       245 
245 
     | 
    
         | 
| 
       246 
246 
     | 
    
         
             
                    it 'return the latex format CAM' do
         
     | 
| 
       247 
247 
     | 
    
         
             
                      expect(subject.to_gnu).to eq(expected)
         
     | 
| 
         @@ -12,12 +12,12 @@ describe Danica::Power do 
     | 
|
| 
       12 
12 
     | 
    
         
             
                calculated: 9.0,
         
     | 
| 
       13 
13 
     | 
    
         
             
                to_tex: {
         
     | 
| 
       14 
14 
     | 
    
         
             
                  string_expected: 'X1^{X2}',
         
     | 
| 
       15 
     | 
    
         
            -
                  numeric_string_expected: ' 
     | 
| 
      
 15 
     | 
    
         
            +
                  numeric_string_expected: '3^{2}',
         
     | 
| 
       16 
16 
     | 
    
         
             
                  partial_string_expected: '3^{X2}'
         
     | 
| 
       17 
17 
     | 
    
         
             
                },
         
     | 
| 
       18 
18 
     | 
    
         
             
                to_gnu: {
         
     | 
| 
       19 
19 
     | 
    
         
             
                  string_expected: 'X1**X2',
         
     | 
| 
       20 
     | 
    
         
            -
                  numeric_string_expected: ' 
     | 
| 
      
 20 
     | 
    
         
            +
                  numeric_string_expected: '3**2',
         
     | 
| 
       21 
21 
     | 
    
         
             
                  partial_string_expected: '3**X2'
         
     | 
| 
       22 
22 
     | 
    
         
             
                }
         
     | 
| 
       23 
23 
     | 
    
         
             
              }
         
     | 
| 
         @@ -22,13 +22,13 @@ describe Danica::Product do 
     | 
|
| 
       22 
22 
     | 
    
         
             
                numeric_variables: [ 1.5, 2, 3.5 ],
         
     | 
| 
       23 
23 
     | 
    
         
             
                to_tex: { 
         
     | 
| 
       24 
24 
     | 
    
         
             
                  string_expected: %w(X1 X2 X3 X4).join(' \cdot '),
         
     | 
| 
       25 
     | 
    
         
            -
                  integer_expected: %w( 
     | 
| 
       26 
     | 
    
         
            -
                  float_expected:  
     | 
| 
      
 25 
     | 
    
         
            +
                  integer_expected: %w(1.5 2 X3 X4).join(' \cdot '),
         
     | 
| 
      
 26 
     | 
    
         
            +
                  float_expected: %w(1.5 2 3.5 X4).join(' \cdot ')
         
     | 
| 
       27 
27 
     | 
    
         
             
                },
         
     | 
| 
       28 
28 
     | 
    
         
             
                to_gnu: {
         
     | 
| 
       29 
29 
     | 
    
         
             
                  string_expected: %w(X1 X2 X3 X4).join(' * '),
         
     | 
| 
       30 
     | 
    
         
            -
                  integer_expected: %w( 
     | 
| 
       31 
     | 
    
         
            -
                  float_expected:  
     | 
| 
      
 30 
     | 
    
         
            +
                  integer_expected: %w(1.5 2 X3 X4).join(' * '),
         
     | 
| 
      
 31 
     | 
    
         
            +
                  float_expected: %w(1.5 2 3.5 X4).join(' * '),
         
     | 
| 
       32 
32 
     | 
    
         
             
                }
         
     | 
| 
       33 
33 
     | 
    
         
             
              }
         
     | 
| 
       34 
34 
     | 
    
         
             
            end
         
     | 
    
        data/spec/lib/danica/sin_spec.rb
    CHANGED
    
    | 
         @@ -9,7 +9,8 @@ describe Danica::Sin do 
     | 
|
| 
       9 
9 
     | 
    
         
             
              it_behaves_like 'a operator with a single input value', {
         
     | 
| 
       10 
10 
     | 
    
         
             
                variable_value: Math::PI / 2.0,
         
     | 
| 
       11 
11 
     | 
    
         
             
                expected_number: 1.0,
         
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
      
 12 
     | 
    
         
            +
                expected_number_tex: 'sin(1.5707963267948966)',
         
     | 
| 
      
 13 
     | 
    
         
            +
                expected_number_gnu: 'sin(1.5707963267948966)',
         
     | 
| 
       13 
14 
     | 
    
         
             
                expected_tex: 'sin(X)',
         
     | 
| 
       14 
15 
     | 
    
         
             
                expected_gnu: 'sin(X)'
         
     | 
| 
       15 
16 
     | 
    
         
             
              }
         
     | 
| 
         @@ -9,7 +9,8 @@ describe Danica::SquaredRoot do 
     | 
|
| 
       9 
9 
     | 
    
         
             
              it_behaves_like 'a operator with a single input value', {
         
     | 
| 
       10 
10 
     | 
    
         
             
                variable_value: 9,
         
     | 
| 
       11 
11 
     | 
    
         
             
                expected_number: 3.0,
         
     | 
| 
       12 
     | 
    
         
            -
                 
     | 
| 
      
 12 
     | 
    
         
            +
                expected_number_tex: '\sqrt{9}',
         
     | 
| 
      
 13 
     | 
    
         
            +
                expected_number_gnu: 'sqrt(9)',
         
     | 
| 
       13 
14 
     | 
    
         
             
                expected_tex: '\sqrt{X}',
         
     | 
| 
       14 
15 
     | 
    
         
             
                expected_gnu: 'sqrt(X)'
         
     | 
| 
       15 
16 
     | 
    
         
             
              }
         
     | 
    
        data/spec/lib/danica/sum_spec.rb
    CHANGED
    
    | 
         @@ -23,16 +23,16 @@ describe Danica::Sum do 
     | 
|
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
              it_behaves_like 'a operator that joins many variables with same operation', {
         
     | 
| 
       25 
25 
     | 
    
         
             
                calculated: 10,
         
     | 
| 
       26 
     | 
    
         
            -
                numeric_variables: [ 1.5,  
     | 
| 
      
 26 
     | 
    
         
            +
                numeric_variables: [ 1.5, 3.0, 3.5 ],
         
     | 
| 
       27 
27 
     | 
    
         
             
                to_tex: {
         
     | 
| 
       28 
28 
     | 
    
         
             
                  string_expected: 'X1 + X2 + X3 + X4',
         
     | 
| 
       29 
     | 
    
         
            -
                  integer_expected: ' 
     | 
| 
       30 
     | 
    
         
            -
                  float_expected: ' 
     | 
| 
      
 29 
     | 
    
         
            +
                  integer_expected: '1.5 + 3 + X3 + X4',
         
     | 
| 
      
 30 
     | 
    
         
            +
                  float_expected: '1.5 + 3 + 3.5 + X4'
         
     | 
| 
       31 
31 
     | 
    
         
             
                },
         
     | 
| 
       32 
32 
     | 
    
         
             
                to_gnu: {
         
     | 
| 
       33 
33 
     | 
    
         
             
                  string_expected: 'X1 + X2 + X3 + X4',
         
     | 
| 
       34 
     | 
    
         
            -
                  integer_expected: ' 
     | 
| 
       35 
     | 
    
         
            -
                  float_expected: ' 
     | 
| 
      
 34 
     | 
    
         
            +
                  integer_expected: '1.5 + 3 + X3 + X4',
         
     | 
| 
      
 35 
     | 
    
         
            +
                  float_expected: '1.5 + 3 + 3.5 + X4'
         
     | 
| 
       36 
36 
     | 
    
         
             
                }
         
     | 
| 
       37 
37 
     | 
    
         
             
              }
         
     | 
| 
       38 
38 
     | 
    
         
             
            end
         
     | 
| 
         @@ -90,14 +90,14 @@ shared_examples 'a operator that knows how to write to a string' do |command, ar 
     | 
|
| 
       90 
90 
     | 
    
         
             
                    end
         
     | 
| 
       91 
91 
     | 
    
         
             
                  end
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                  it 'outputs a text format  
     | 
| 
      
 93 
     | 
    
         
            +
                  it 'outputs a text format of numbers' do
         
     | 
| 
       94 
94 
     | 
    
         
             
                    expect(subject.public_send(command)).to eq(integer_expected)
         
     | 
| 
       95 
95 
     | 
    
         
             
                  end
         
     | 
| 
       96 
96 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
                  context 'when numeric variables  
     | 
| 
      
 97 
     | 
    
         
            +
                  context 'when numeric variables are a float value' do
         
     | 
| 
       98 
98 
     | 
    
         
             
                    let(:numeric_variables_index) { 2 }
         
     | 
| 
       99 
99 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
                    it 'outputs a text format  
     | 
| 
      
 100 
     | 
    
         
            +
                    it 'outputs a text format of numbers' do
         
     | 
| 
       101 
101 
     | 
    
         
             
                      expect(subject.public_send(command)).to eq(float_expected)
         
     | 
| 
       102 
102 
     | 
    
         
             
                    end
         
     | 
| 
       103 
103 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -1,5 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            shared_examples 'a operator with a single input value' do |arguments|
         
     | 
| 
       2 
     | 
    
         
            -
              include_context 'variables are initialized', arguments, *%w(variable_value expected_number expected_tex  
     | 
| 
      
 2 
     | 
    
         
            +
              include_context 'variables are initialized', arguments, *%w(variable_value expected_number expected_tex expected_number_tex expected_gnu expected_number_gnu)
         
     | 
| 
       3 
3 
     | 
    
         
             
              let(:variable) { { name: "X", value: variable_value } }
         
     | 
| 
       4 
4 
     | 
    
         
             
              subject { described_class.new(variable) }
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
         @@ -41,7 +41,7 @@ shared_examples 'a operator with a single input value' do |arguments| 
     | 
|
| 
       41 
41 
     | 
    
         
             
                    subject.variables[0].value = variable_value
         
     | 
| 
       42 
42 
     | 
    
         
             
                  end
         
     | 
| 
       43 
43 
     | 
    
         
             
                  it 'prints both numbers' do
         
     | 
| 
       44 
     | 
    
         
            -
                    expect(subject.to_tex).to eq( 
     | 
| 
      
 44 
     | 
    
         
            +
                    expect(subject.to_tex).to eq(expected_number_tex)
         
     | 
| 
       45 
45 
     | 
    
         
             
                  end
         
     | 
| 
       46 
46 
     | 
    
         
             
                end
         
     | 
| 
       47 
47 
     | 
    
         
             
              end
         
     | 
| 
         @@ -60,7 +60,7 @@ shared_examples 'a operator with a single input value' do |arguments| 
     | 
|
| 
       60 
60 
     | 
    
         
             
                    subject.variables[0].value = variable_value
         
     | 
| 
       61 
61 
     | 
    
         
             
                  end
         
     | 
| 
       62 
62 
     | 
    
         
             
                  it 'prints both numbers' do
         
     | 
| 
       63 
     | 
    
         
            -
                    expect(subject.to_gnu).to eq( 
     | 
| 
      
 63 
     | 
    
         
            +
                    expect(subject.to_gnu).to eq(expected_number_gnu)
         
     | 
| 
       64 
64 
     | 
    
         
             
                  end
         
     | 
| 
       65 
65 
     | 
    
         
             
                end
         
     | 
| 
       66 
66 
     | 
    
         
             
              end
         
     |