Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into 218_update-eo-runtime-to-0.32.0
Browse files Browse the repository at this point in the history
  • Loading branch information
levBagryansky committed Oct 17, 2023
2 parents 5623d97 + 8c1647a commit 04fc11b
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Matcher for array whose elements satisfy a sequence of matchers.
# The array size must equal the number of element matchers.
[matchers...] > array-each-matcher
memory * > mismatches
cage (list *).with > mismatches

[a] > match
a > act!
Expand All @@ -40,7 +40,8 @@
matchers.length
act.length
seq
mismatches.write *
mismatches.write
(list *).with
reducedi.
list
act
Expand Down
9 changes: 5 additions & 4 deletions src/main/eo/org/eolang/hamcrest/matchers/has-item-matcher.eo
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

# Wraps an existing matcher and apply it to every item in array.
[matcher] > has-item-matcher
memory > mismatches
list *
cage > mismatches
list.with
[a] > match
[s] > apply
if. > @
Expand All @@ -44,8 +44,9 @@
FALSE
seq > @
mismatches.write
list
*
with.
list
*
reducedi.
list
a
Expand Down
7 changes: 4 additions & 3 deletions src/main/eo/org/eolang/hamcrest/matchers/has-items-matcher.eo
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

# Wraps an array of matchers and apply them to every item in array.
[matchers...] > has-items-matcher
memory > mismatches
*
cage > mismatches
list.with
[a] > all-match
a > act!
reduced. > @
Expand All @@ -52,7 +52,8 @@
[a] > match
a > act!
seq > @
mismatches.write *
mismatches.write
(list *).with
reducedi.
list
act
Expand Down
31 changes: 9 additions & 22 deletions src/test/eo/org/eolang/hamcrest/arrays-matchers-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@
+tests
+version 0.0.0

# @todo #212:30min Enable the tests when eo-collections 0.10.0 is in objectionary. Need to enable
# next tests that were disabled because of conflict with eo-collections 0.10.0:
# has-items-int-test, contains-all-of-string-failed, contains-any-of-string-failed,
# starts-with-any-of-string-failed, all-of-close-to-failed-output,
# any-of-number-test-failed-output, all-of-several-failed-output, starts-with-all-of-string-failed,
# ends-with-all-of-string-failed, all-of-number-test-failed-output, ends-with-any-of-string-failed,
# arrays-failed-output, any-of-several-failed-output, nested-has-items, arrays-each-items,
# arrays-each-items-complex-case, has-item-string-test, has-item-float-test
# @todo #218:90min Enable the test below when eo-collections with 0.32.0
# eo-runtime will be released. Now it uses memory somewhere so we get
# memory enclosure
Expand All @@ -46,48 +38,43 @@
$.equal-to 2

[] > has-item-string-test
assert-that > res
assert-that > @
* "1" "2" "3"
$.has-item
$.equal-to "3"
nop > @

[] > has-item-float-test
assert-that > res
assert-that > @
* 1.0 44.0
$.has-item
$.is
$.greater-than 10.0
nop > @

[] > has-items-int-test
assert-that > res
* 99 101
$.has-items
$.greater-than 100
nop > @
assert-that
* 99 101
$.has-items
$.greater-than 100

[] > nested-has-items
assert-that > res
assert-that > @
* "a" "b" "c" "d"
$.has-items
$.equal-to "c"
nop > @

[] > arrays-each-items
assert-that > res
assert-that > @
* 1 2
$.array-each
$.equal-to 1
$.equal-to 2
nop > @

[] > arrays-each-items-complex-case
assert-that > res
assert-that > @
* "vice" "c" -5 ((number 13).as-float)
$.array-each
$.equal-to "vice"
$.equal-to "c"
$.less-than 0
$.greater-than 10.0
nop > @
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
$.all-of
$.equal-to 1
"all of numbers conditions"
assert-that > res
assert-that > @
suggestion
$.equal-to "all of numbers conditions\nExpected: <1> equal to value\n but: a value was <100>"
nop > @

[] > all-of-several-failed-output
[] > suggestion
Expand All @@ -52,10 +51,9 @@
$.greater-than 100
$.less-than 2
"all of conditions"
assert-that > res
assert-that > @
suggestion
$.equal-to "all of conditions\nExpected: <1> equal to value and <100> less than value and <2> greater than value\n but: a value was <3>"
nop > @

[] > all-of-close-to-failed-output
[] > suggestion
Expand All @@ -68,7 +66,6 @@
$.greater-than 100.0
$.close-to 20.0 2.2
"all of conditions"
assert-that > res
assert-that > @
suggestion
$.equal-to "all of conditions\nExpected: <1.0> equal to value and <100.0> less than value and a float value within <20.0> of <2.2>\n but: a value was <42.0>"
nop > @
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
150.minus 50
$.any-of
$.equal-to 1
assert-that > res
assert-that > @
suggestion
$.equal-to "\nExpected: <1> equal to value\n but: a value was <100>"
nop > @

[] > any-of-several-failed-output
[] > suggestion
Expand All @@ -46,10 +45,9 @@
$.equal-to 1
$.greater-than 100
$.less-than -6
assert-that > res
assert-that > @
suggestion
$.equal-to "\nExpected: <1> equal to value or <100> less than value or <-6> greater than value\n but: a value was <3>"
nop > @

# @todo #149:30min To remove this nop object
# when this test will be stable. To do that we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
$.array-each
$.equal-to 1
$.equal-to 3
assert-that > res
assert-that > @
suggestion
$.contains-string "\nExpected: <1> equal to value and <3> equal to value\n but: mismatches:"
nop > @
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@
$.any-of
$.is-substring "2"
"is-substring"
assert-that > res
assert-that > @
suggestion
$.equal-to "is-substring\nExpected: string contains: <2>\n but: a value was <Hello>"
nop > @

[] > contains-all-of-string-failed
[] > suggestion
Expand All @@ -56,11 +55,6 @@
$.is-substring "2"
$.is-substring "happy"
"is-substring"
assert-that > res
assert-that > @
suggestion
$.equal-to "is-substring\nExpected: string contains: <2> and string contains: <happy>\n but: a value was <so sad>"
nop > @




Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
+tests
+version 0.0.0

# @todo #218:90min Enable the following tests when eo strings will be updated.
# Now they use text.contain object that was changed in new eo-runtime
# version.
[] > simple-ends-with-string-failed
[] > suggestion
assert-that > @
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
+tests
+version 0.0.0

# @todo #218:90min Enable the following tests when eo strings will be updated.
# Now they use text.starts-with object that was changed in new eo-runtime
# version.
[] > simple-starts-with-string-failed
[] > suggestion
assert-that > @
Expand All @@ -45,11 +48,13 @@
$.contains-string "世"
$.string-starts-with "ет"
"starts-with"
assert-that > res
assert-that > @
suggestion
$.equal-to "starts-with\nExpected: string contains: <Привет> and string contains: <世> and string starts with: <ет>\n but: a value was <Привет, 世界>"
nop > @

# @todo #218:90min Enable the following tests when eo strings will be updated.
# Now they use text.starts-with and text.contains objects that was changed
# in new eo-runtime version.
[] > starts-with-all-of-string-failed
[] > suggestion
assert-that > @
Expand All @@ -59,7 +64,7 @@
$.string-starts-with "dddd"
$.contains-string "界"
"starts-with"
assert-that > res
suggestion
$.equal-to "starts-with\nExpected: string contains: <Привет> or string starts with: <dddd> or string contains: <界>\n but: a value was <ffffffffffff>"
nop > @
assert-that
suggestion
$.equal-to "starts-with\nExpected: string contains: <Привет> or string starts with: <dddd> or string contains: <界>\n but: a value was <ffffffffffff>"

0 comments on commit 04fc11b

Please sign in to comment.