array_logic 0.2.2 → 0.2.3
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.
- data/lib/array_logic/rule.rb +1 -1
- data/lib/array_logic/version.rb +7 -1
- data/test/array_logic/rule_test.rb +11 -1
- metadata +1 -1
data/lib/array_logic/rule.rb
CHANGED
data/lib/array_logic/version.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
module ArrayLogic
|
2
|
-
VERSION = "0.2.
|
2
|
+
VERSION = "0.2.3"
|
3
3
|
end
|
4
4
|
|
5
5
|
# History
|
6
6
|
# =======
|
7
7
|
#
|
8
|
+
# Version 0.2.3
|
9
|
+
# -------------
|
10
|
+
# Bug fix: Identification of ids in rule would see a number preceded by a number
|
11
|
+
# as a valid id. So 51 would be seen as 1, and 34 as 4. Updated id pattern to
|
12
|
+
# only return numbers that are preceded by a letter.
|
13
|
+
#
|
8
14
|
# Version 0.2.2
|
9
15
|
# -------------
|
10
16
|
# Refactor to allow functions to be more flexible. That's is, to handle unexpected
|
@@ -414,11 +414,21 @@ module ArrayLogic
|
|
414
414
|
assert_equal([1, 2, 3, 4], @rule.object_ids_used)
|
415
415
|
end
|
416
416
|
|
417
|
-
def
|
417
|
+
def test_object_ids_used_does_not_return_duplicates
|
418
418
|
@rule.rule = 't1 and t2 and (2 in t1 t2)'
|
419
419
|
assert_equal([1, 2], @rule.object_ids_used)
|
420
420
|
end
|
421
421
|
|
422
|
+
def test_object_ids_used_with_function
|
423
|
+
@rule.rule = 'sum(:cope_index) > 10'
|
424
|
+
assert_equal([], @rule.object_ids_used)
|
425
|
+
end
|
426
|
+
|
427
|
+
def test_object_ids_used_with_function_and_valid_ids
|
428
|
+
@rule.rule = 't1 and t2 and (sum(:cope_index) > 10)'
|
429
|
+
assert_equal([1, 2], @rule.object_ids_used)
|
430
|
+
end
|
431
|
+
|
422
432
|
def test_matching_combinations
|
423
433
|
@rule.rule = 't1 or t2'
|
424
434
|
assert_equal([[1], [2], [1,2]], @rule.matching_combinations)
|