parsecs 0.11.9 → 0.12.0
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/ext/libnativemath/extconf.rb +1 -1
- data/test/test_parsec.rb +36 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e28378b87ca822e69e9a4d48db13bc3431acdb16a9f48093e2e04129764678ec
|
4
|
+
data.tar.gz: f1cad169c966b3fada82a0e8d755f61cd6a5e0eb6edf295475afca6e85b2bbb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d05f4661a50c11d978292731897d993797c9bccc1900633980f891758ce4562fbab528b7b90491c9f3cebd209dd3f0d9b3574186c267b8aec3e2a1aa9eb1b437
|
7
|
+
data.tar.gz: ea4b8885920feaefe1fc631f30a7253c30bf99c5ee0b141c6c1c62a6ff257eec8b126efd0cd61866297783f0751b9c3a0ed9342e76b868eb75cefa9ea91e1c0d
|
@@ -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 = '
|
41
|
+
COMMIT = '8769175390cafd9c40b52477f1c97184266c4a68'.freeze
|
42
42
|
|
43
43
|
Dir.chdir(BASEDIR) do
|
44
44
|
system('git init')
|
data/test/test_parsec.rb
CHANGED
@@ -302,4 +302,40 @@ class TestParsec < Minitest::Test
|
|
302
302
|
assert_raises(SyntaxError) { parsec.eval_equation('timediff("02:00:00", "02:30:62")') }
|
303
303
|
assert_raises(SyntaxError) { parsec.eval_equation('timediff("24:00:00", "02:30:59")') }
|
304
304
|
end
|
305
|
+
|
306
|
+
def test_regex
|
307
|
+
parsec = Parsec::Parsec
|
308
|
+
assert_equal('World', parsec.eval_equation('regex("Hello World", "Hello (.*)")'))
|
309
|
+
assert_equal('71', parsec.eval_equation('regex("71 123456789", "([0-9]{2}) [0-9]{9}")'))
|
310
|
+
assert_equal('ISSUE-123', parsec.eval_equation('regex("ISSUE-123 Fix bug", "(ISSUE-[0-9]+) (.*)")'))
|
311
|
+
assert_equal('2019-01-01', parsec.eval_equation('regex("2019-01-01T:08:30", "([0-9]{4}-[0-9]{2}-[0-9]{2})T:[0-9]{2}:[0-9]{2}")'))
|
312
|
+
assert_equal('2019-01', parsec.eval_equation('regex("2019-01-01T:08:30", "([0-9]{4}-[0-9]{2})-[0-9]{2}T:[0-9]{2}:[0-9]{2}")'))
|
313
|
+
assert_equal('2019', parsec.eval_equation('regex("2019-01-01T:08:30", "([0-9]{4})-[0-9]{2}-[0-9]{2}T:[0-9]{2}:[0-9]{2}")'))
|
314
|
+
# Regex tests with no capture group
|
315
|
+
assert_equal('', parsec.eval_equation('regex("Hello World", "Hello .*")'))
|
316
|
+
|
317
|
+
# Regex tests with optional groups
|
318
|
+
assert_equal('1234', parsec.eval_equation('regex("Product 1234 (color: red)", "Product ([0-9]+)( \\\\(color: (.*)\\\\))?")'))
|
319
|
+
assert_equal('1234', parsec.eval_equation('regex("Product 1234", "Product ([0-9]+)( \\\\(color: (.*)\\\\))?")'))
|
320
|
+
|
321
|
+
# Regex tests with alternation
|
322
|
+
assert_equal('Green', parsec.eval_equation('regex("Green Apple", "(Green|Red) Apple")'))
|
323
|
+
assert_equal('Red', parsec.eval_equation('regex("Red Apple", "(Green|Red) Apple")'))
|
324
|
+
|
325
|
+
# Regex tests with character classes
|
326
|
+
assert_equal('A123', parsec.eval_equation('regex("BoxA123", "Box([A-Za-z][0-9]+)")'))
|
327
|
+
assert_equal('C456', parsec.eval_equation('regex("BoxC456", "Box([A-Za-z][0-9]+)")'))
|
328
|
+
|
329
|
+
# Regex tests with positive lookaheads
|
330
|
+
assert_equal('apple', parsec.eval_equation('regex("apple123banana", "([a-z]+)(?=\\\\d+)")'))
|
331
|
+
|
332
|
+
assert_equal('456', parsec.eval_equation('regex("123red456blue", "(\\\\d+)(?=blue)")'))
|
333
|
+
|
334
|
+
# Regex tests with negative lookaheads
|
335
|
+
assert_equal('123', parsec.eval_equation('regex("123red456blue", "(\\\\d+)(?!blue)")'))
|
336
|
+
|
337
|
+
# Regex tests with nested lookaheads
|
338
|
+
assert_equal('apple', parsec.eval_equation('regex("apple123redbanana", "(?=apple)([a-z]+)(?=\\\\d+red)")'))
|
339
|
+
assert_equal('apple', parsec.eval_equation('regex("apple123red456banana", "(?=apple)([a-z]+)(?=(\\\\d+red)\\\\d+banana)")'))
|
340
|
+
end
|
305
341
|
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.
|
4
|
+
version: 0.12.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-
|
13
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: minitest
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '12.1'
|
43
|
-
description:
|
43
|
+
description: Parsecs is a gem to evaluate equations using a lighter and extented version
|
44
44
|
of the muparserx C++ library
|
45
45
|
email:
|
46
46
|
- nilton.vasques@gmail.com
|
@@ -58,7 +58,7 @@ files:
|
|
58
58
|
- lib/parsec.rb
|
59
59
|
- lib/string_to_boolean_refinements.rb
|
60
60
|
- test/test_parsec.rb
|
61
|
-
homepage: https://github.com/
|
61
|
+
homepage: https://github.com/oxeanbits/parsec
|
62
62
|
licenses:
|
63
63
|
- MIT
|
64
64
|
metadata: {}
|