parsecs 0.12.0 → 0.13.1

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: e28378b87ca822e69e9a4d48db13bc3431acdb16a9f48093e2e04129764678ec
4
- data.tar.gz: f1cad169c966b3fada82a0e8d755f61cd6a5e0eb6edf295475afca6e85b2bbb1
3
+ metadata.gz: 73ce5ab42330d07261fea6366c8447a84d42f122fd1e17ed5f5dfe2e5ae1b98a
4
+ data.tar.gz: 2fa1abbbd7c774413ba865cc323a8af10aba334ecce37d20253e9d66ddb4044a
5
5
  SHA512:
6
- metadata.gz: d05f4661a50c11d978292731897d993797c9bccc1900633980f891758ce4562fbab528b7b90491c9f3cebd209dd3f0d9b3574186c267b8aec3e2a1aa9eb1b437
7
- data.tar.gz: ea4b8885920feaefe1fc631f30a7253c30bf99c5ee0b141c6c1c62a6ff257eec8b126efd0cd61866297783f0751b9c3a0ed9342e76b868eb75cefa9ea91e1c0d
6
+ metadata.gz: 7651ae914b16c18d89fddd909198139dead5b7bacb90fd7a8e01825785e45cef76cedccc9ea3d4fab937f2928a478fb7c6a526cbfeaeccfe3f1531a00b463139
7
+ data.tar.gz: 1fcd74afb483205737096788c793da50158ab610e8a641fa168b5066cb6d34dde928ad6cfacb21ce68cc4e3cd483a32617f252ed5aa59a9b30f8cf99ead69b75
@@ -38,7 +38,7 @@ libs.each do |lib|
38
38
  end
39
39
 
40
40
  GIT_REPOSITORY = 'https://github.com/oxeanbits/equations-parser.git'.freeze
41
- COMMIT = '8769175390cafd9c40b52477f1c97184266c4a68'.freeze
41
+ COMMIT = 'b81e50bc4c43556f8d75566bf0f86a2e71a7ac4e'.freeze
42
42
 
43
43
  Dir.chdir(BASEDIR) do
44
44
  system('git init')
@@ -73,6 +73,9 @@ end
73
73
  Dir.chdir(BASEDIR) do
74
74
  Dir.chdir('ext/libnativemath/') do
75
75
  system('make')
76
+
77
+ next if RUBY_PLATFORM.match? 'darwin'
78
+
76
79
  if RUBY_VERSION >= '3.2'
77
80
  FileUtils.cp('libnativemath.so', '../../lib/')
78
81
  end
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.9'.freeze
9
+ VERSION = '0.13.1'.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
@@ -338,4 +338,38 @@ class TestParsec < Minitest::Test
338
338
  assert_equal('apple', parsec.eval_equation('regex("apple123redbanana", "(?=apple)([a-z]+)(?=\\\\d+red)")'))
339
339
  assert_equal('apple', parsec.eval_equation('regex("apple123red456banana", "(?=apple)([a-z]+)(?=(\\\\d+red)\\\\d+banana)")'))
340
340
  end
341
+
342
+ def test_weekyear
343
+ parsec = Parsec::Parsec
344
+
345
+ # Week number of the year when 1st of January is a Sunday
346
+ assert_equal(1, parsec.eval_equation('weekyear("2023-01-01")'))
347
+ assert_equal(1, parsec.eval_equation('weekyear("2023-01-07")'))
348
+ assert_equal(2, parsec.eval_equation('weekyear("2023-01-08")'))
349
+
350
+ assert_equal(17, parsec.eval_equation('weekyear("2023-04-25")'))
351
+ assert_equal(17, parsec.eval_equation('weekyear("2023-04-29")'))
352
+ assert_equal(18, parsec.eval_equation('weekyear("2023-04-30")'))
353
+ assert_equal(18, parsec.eval_equation('weekyear("2023-05-06")'))
354
+
355
+ assert_equal(52, parsec.eval_equation('weekyear("2023-12-24")'))
356
+ assert_equal(53, parsec.eval_equation('weekyear("2023-12-31")'))
357
+
358
+ # Week number of the year a leap year
359
+ assert_equal(1, parsec.eval_equation('weekyear("2024-01-01")'))
360
+ assert_equal(1, parsec.eval_equation('weekyear("2024-01-06")'))
361
+ assert_equal(2, parsec.eval_equation('weekyear("2024-01-07")'))
362
+
363
+ assert_equal(52, parsec.eval_equation('weekyear("2024-12-22")'))
364
+ assert_equal(53, parsec.eval_equation('weekyear("2024-12-29")'))
365
+
366
+ # Week number of the year when 1st of January is friday
367
+ assert_equal(53, parsec.eval_equation('weekyear("2027-01-01")'))
368
+ assert_equal(53, parsec.eval_equation('weekyear("2027-01-02")'))
369
+ assert_equal(1, parsec.eval_equation('weekyear("2027-01-03")'))
370
+
371
+ assert_equal(52, parsec.eval_equation('weekyear("2027-12-27")'))
372
+ assert_equal(52, parsec.eval_equation('weekyear("2027-12-31")'))
373
+ assert_equal(53, parsec.eval_equation('weekyear("2028-01-01")'))
374
+ end
341
375
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsecs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nilton Vasques
8
8
  - Victor Cordeiro
9
9
  - Beatriz Fagundes
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-04-21 00:00:00.000000000 Z
13
+ date: 2023-07-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
@@ -62,7 +62,7 @@ homepage: https://github.com/oxeanbits/parsec
62
62
  licenses:
63
63
  - MIT
64
64
  metadata: {}
65
- post_install_message:
65
+ post_install_message:
66
66
  rdoc_options: []
67
67
  require_paths:
68
68
  - lib
@@ -81,8 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - swig
83
83
  - cmake
84
- rubygems_version: 3.4.10
85
- signing_key:
84
+ rubygems_version: 3.1.6
85
+ signing_key:
86
86
  specification_version: 4
87
87
  summary: A gem to evaluate equations using muparserx C++ library
88
88
  test_files: