parsecs 0.12.0 → 0.13.0

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: 5abfe818972ad4f07089bc1d4a481a7c72bc8b5afb80ee490b3b7f5150f71e49
4
+ data.tar.gz: 6a10b41f9ebf29ce4a4d4acedee12bfd09695ecea764b597b7d9b8ef40c7d1a0
5
5
  SHA512:
6
- metadata.gz: d05f4661a50c11d978292731897d993797c9bccc1900633980f891758ce4562fbab528b7b90491c9f3cebd209dd3f0d9b3574186c267b8aec3e2a1aa9eb1b437
7
- data.tar.gz: ea4b8885920feaefe1fc631f30a7253c30bf99c5ee0b141c6c1c62a6ff257eec8b126efd0cd61866297783f0751b9c3a0ed9342e76b868eb75cefa9ea91e1c0d
6
+ metadata.gz: f2a8d47fa873fb8e8841cea8829d468ff06d7defeb5fb87d06e5432084b2609698550f483296252b11ae6de390cc40fe1cae842a963a293c76502af45e3e5d62
7
+ data.tar.gz: b5e0a321445cdddd9b771f7496490cd76c2a51e687b74fc0b83685eb98c4dc369b9958ff4925a41cb8331ff93f8f7e955d907764336223da9d8290627688eba6
@@ -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')
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,7 +1,7 @@
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.0
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: 2023-04-21 00:00:00.000000000 Z
13
+ date: 2023-04-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest