Skip to content

Commit

Permalink
#13 - all-of and any-of didn't work properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Graur committed May 25, 2022
1 parent 195efcd commit 65f3c34
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/main/eo/org/eolang/hamcrest/assert-that.eo
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@
[i]
i.description-of > @

# Matcher for array whose elements satisfy a sequence of matchers.
# The array size must equal the number of element matchers.
[matchers...] > array-each

memory > mismatches
Expand Down
23 changes: 19 additions & 4 deletions src/test/eo/org/eolang/hamcrest/all-of-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,28 @@
+alias org.eolang.hamcrest.assert-that
+junit

# @todo #14:45min I assumed that we need to add more
# tests with .all-of matcher (e.g. several different
# matchers and nested matchers) after fixing issue in
# objectionary/eo#623
[] > all-of-numbers-test
assert-that > @
150.sub 50
$.all-of
$.equal-to 100
"all of numbers conditions"

[] > all-of-several
assert-that > @
15.mul 3
$.all-of
$.equal-to 45
$.greater-than 40
$.less-than 100
"all of conditions"

[] > all-of-close-to
assert-that > @
22.0
$.all-of
$.equal-to
22.as-float
$.greater-than 10.0
$.close-to 20.0 2.2
"all of conditions"
22 changes: 19 additions & 3 deletions src/test/eo/org/eolang/hamcrest/any-of-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,28 @@
+alias org.eolang.hamcrest.assert-that
+junit

# @todo #15:45min I assumed that we need to add more tests
# of .any-of matcjher (e.g. several different matchers, nested
# matchers etc.) after fixing issue in objectionary/eo#623
[] > any-of-numbers-test
assert-that > @
150.div 3
$.any-of
$.equal-to 50
"any of number conditions"

[] > any-of-several
assert-that > @
100.sub 5
$.any-of
$.equal-to 45
$.greater-than 40
$.less-than -111
"any of conditions"

[] > any-of-close-to
assert-that > @
30.0
$.any-of
$.equal-to
1000.as-float
$.greater-than 777.0
$.close-to 30.0 0.1
"any of conditions"
4 changes: 0 additions & 4 deletions src/test/eo/org/eolang/hamcrest/described-as-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
+alias org.eolang.hamcrest.assert-that
+junit

# @todo #16:45min I assumed that we need to add
# more tests of .described-as matcher and more
# varargs values after fixing issue in
# objectionary/eo#623
[] > two-sum-described-as-equal-to-test
assert-that > @
15.add 5
Expand Down

1 comment on commit 65f3c34

@0pdd
Copy link

@0pdd 0pdd commented on 65f3c34 May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:

(): did not find expected key while parsing a block mapping at line 1 column 1

Please, copy and paste this stack trace to GitHub:

Psych::SyntaxError
(<unknown>): did not find expected key while parsing a block mapping at line 1 column 1
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:456:in `parse'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:456:in `parse_stream'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:390:in `parse'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:349:in `safe_load'
/app/objects/git_repo.rb:54:in `config'
/app/objects/job_emailed.rb:37:in `rescue in proceed'
/app/objects/job_emailed.rb:34:in `proceed'
/app/objects/job_commiterrors.rb:36:in `proceed'
/app/objects/job_detached.rb:48:in `exclusive'
/app/objects/job_detached.rb:36:in `block in proceed'
/app/objects/job_detached.rb:36:in `fork'
/app/objects/job_detached.rb:36:in `proceed'
/app/0pdd.rb:366:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `block in compile!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (3 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1032:in `route_eval'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (2 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1061:in `block in process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1011:in `block in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1129:in `block in dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1124:in `dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `block in call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:929:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/xss_header.rb:18:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/path_traversal.rb:16:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/json_csrf.rb:26:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/frame_options.rb:31:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/logger.rb:17:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/common_logger.rb:38:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:253:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:246:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:216:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1991:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `block in call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1769:in `synchronize'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'

Please sign in to comment.