parsecs 0.11.5 → 0.11.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df4539b513e63438ad85c1de1e92742fec4c5c8ddca1966d6848cb99f68f8ae3
4
- data.tar.gz: ff664c712a7c6ce57f532f0dc42d5d0a8b787b99a794c1ed97b2d6c6fb390478
3
+ metadata.gz: eb2d58cc370e6c777c700923e4fa4bfc75bb636787a6a6cc1072d6102bc6ad96
4
+ data.tar.gz: 45081cad563cf4dec9d10da97632a69b9018676868b774151fdf43428e2910d7
5
5
  SHA512:
6
- metadata.gz: 34a1ac857f98619aff93b054faa23b7326b83172413709273e621130a7b5c00a98d0990fc1e3d3472a101ac64b3023ee512134575644989c00ad6475f685d371
7
- data.tar.gz: a05281849a525fe6937e258544e7c3115dddaccc64ec63818aec17b81d8e2cc1ed9888a1a54cb4f3eecf88666214665a950b31e87c2c32715e2506d6cd0a4c87
6
+ metadata.gz: fdea60ccb0971c7434f32ac105248908a2aca0bac01ce6c3ba1608ac4d6fc0e22a4c2ecaaee0f2d8ca5fc4242d401dbc0fc176b5532bf44a9c6ec7cf330f8dfb
7
+ data.tar.gz: 461f9ce0cf4507390ecee30d31e67c827ab601e71677037ecfbaaa62ef90f9c732f1345be130f58ced14078fffa99b0e2d8c0d339decece3abd0ca6f928c5dc3
@@ -38,7 +38,7 @@ libs.each do |lib|
38
38
  end
39
39
 
40
40
  GIT_REPOSITORY = 'https://github.com/niltonvasques/equations-parser.git'.freeze
41
- COMMIT = 'd49225cddcf2fb08d8604fc2a7e6198983dcd1b9'.freeze
41
+ COMMIT = 'fe93ca5534484b05cd1eb68f7acfc32ff05dc20c'.freeze
42
42
 
43
43
  Dir.chdir(BASEDIR) do
44
44
  system('git init')
data/lib/parsec.rb CHANGED
@@ -6,7 +6,7 @@ module Parsec
6
6
  class Parsec
7
7
  using StringToBooleanRefinements
8
8
 
9
- VERSION = '0.11.5'.freeze
9
+ VERSION = '0.11.6'.freeze
10
10
 
11
11
  # evaluates the equation and returns only the result
12
12
  def self.eval_equation(equation)
data/test/test_parsec.rb CHANGED
@@ -13,6 +13,11 @@ class TestParsec < Minitest::Test
13
13
  parser = Parsec::Parsec
14
14
  assert_equal(10, parser.eval_equation('(5 + 1) + (6 - 2)'))
15
15
  assert_equal(16, parser.eval_equation('4 + 4 * 3'))
16
+ assert_equal(604.1952, parser.eval_equation('35.52 * 17.01'))
17
+ assert_equal(404.5728, parser.eval_equation('35.52 * 11.39'))
18
+ assert_equal(634.2688, parser.eval_equation('11.84 * 53.57'))
19
+ assert_equal(423.3984, parser.eval_equation('11.84 * 35.76'))
20
+ assert_equal(309.96528, parser.eval_equation('(604.1952 + 404.5728 + 634.2688 + 423.3984) * 0.15'))
16
21
  assert_equal(2, parser.eval_equation('10.5 / 5.25'))
17
22
  assert_equal(5, parser.eval_equation('abs(-5)'))
18
23
  assert_equal(1, parser.eval_equation('log10(10)'))
@@ -25,8 +30,8 @@ class TestParsec < Minitest::Test
25
30
  def test_complex_math_equations
26
31
  parser = Parsec::Parsec
27
32
  assert_equal(6, parser.eval_equation('sqrt(16) + cbrt(8)'))
28
- assert_equal(4.30259, parser.eval_equation('log10(10) + ln(e) + log(10)'))
29
- assert_equal(2.0, parser.eval_equation('sin(1) + cos(0) + tan(0.15722)'))
33
+ assert_equal(4.30258509299405, parser.eval_equation('log10(10) + ln(e) + log(10)'))
34
+ assert_equal(1.99999931685569, parser.eval_equation('sin(1) + cos(0) + tan(0.15722)'))
30
35
  assert_equal(16, parser.eval_equation('max(1, 2) + min(3, 4) + sum(5, 6)'))
31
36
  assert_equal(9.6, parser.eval_equation('avg(9, 9.8, 10)'))
32
37
  assert_equal(8, parser.eval_equation('pow(2, 3)'))
@@ -97,7 +102,7 @@ class TestParsec < Minitest::Test
97
102
  def test_general_equations
98
103
  parsec = Parsec::Parsec
99
104
  assert_equal(1, parsec.eval_equation('((0.09/1.0)+2.58)-1.67'))
100
- assert_equal(40.6853, parsec.eval_equation('10^log(3+2)'))
105
+ assert_equal(40.6853365119738, parsec.eval_equation('10^log(3+2)'))
101
106
  assert_equal(1, parsec.eval_equation('log(e)'))
102
107
  assert_equal(2, parsec.eval_equation('2^5^0'))
103
108
  assert_equal('yes', parsec.eval_equation('5 > 3 ? "yes" : "no"'))
@@ -265,7 +270,7 @@ class TestParsec < Minitest::Test
265
270
  assert_equal({ value: 362_880_0, type: :int }, parsec.eval_equation_with_type('10!'))
266
271
  equation_date = 'daysdiff("2018-01-01", "2017-12-31")'
267
272
  assert_equal({ value: 1, type: :int }, parsec.eval_equation_with_type(equation_date))
268
- assert_equal({ value: 40.6853, type: :float }, parsec.eval_equation_with_type('10^log(3+2)'))
273
+ assert_equal({ value: 40.6853365119738, type: :float }, parsec.eval_equation_with_type('10^log(3+2)'))
269
274
  assert_equal({ value: 5.1, type: :float }, parsec.eval_equation_with_type('number("5.1")'))
270
275
  equation_if = '4 > 2 ? "bigger" : "smaller"'
271
276
  assert_equal({ value: 'bigger', type: :string }, parsec.eval_equation_with_type(equation_if))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsecs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nilton Vasques
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-10-18 00:00:00.000000000 Z
13
+ date: 2022-11-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest