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

Commit

Permalink
Merge pull request #63 from objectionary/62
Browse files Browse the repository at this point in the history
upgrade to 0.23.11
  • Loading branch information
Graur authored Jun 18, 2022
2 parents 7309fc0 + a31b514 commit 7d285da
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 98 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ This is a collection of test matchers for [EO](https://www.eolang.org) in [Hamcr
[] > my-first-test
assert-that > @
4.add 4
4.plus 4
$.all-of
$.equal-to 8
$.less-than 100
"sum of two numbers"
```

The ```assert-that``` object is a stylized sentence for making a test assertion.
In this example, the subject of the assertion is the object ```4.add 4``` that is the first method parameter. The second method parameter is a matcher for the first parameter, here a matcher that checks one object is equal and less than to another objects. The third parameter is is an optional string description of the test case (```sum of two numbers```). The test passes since all conditions are ```TRUE```.
In this example, the subject of the assertion is the object ```4.plus 4``` that is the first method parameter. The second method parameter is a matcher for the first parameter, here a matcher that checks one object is equal and less than to another objects. The third parameter is is an optional string description of the test case (```sum of two numbers```). The test passes since all conditions are ```TRUE```.

### Matchers

Expand All @@ -46,7 +46,7 @@ Hamcrest comes with a library of useful matchers. Here are some of the most impo
[] > core-matchers-test
assert-that > @
5.mul 4
5.times 4
$.is
$.anything
"multiply of two numbers"
Expand All @@ -66,7 +66,7 @@ Hamcrest comes with a library of useful matchers. Here are some of the most impo
[] > logical-matchers-test
assert-that > @
50.sub 10
50.minus 10
$.all-of
$.not
$.equal-to 5
Expand Down
2 changes: 1 addition & 1 deletion examples/all-of-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

[] > all-of-several
assert-that > @
15.mul 3
15.times 3
$.all-of
$.equal-to 45
$.greater-than 40
Expand Down
2 changes: 1 addition & 1 deletion examples/any-of-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

[] > any-of-several
assert-that > @
100.sub 5
100.minus 5
$.any-of
$.equal-to 45
$.greater-than 40
Expand Down
4 changes: 2 additions & 2 deletions examples/anything-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

[] > anything-two-sum-test
assert-that > @
4.add 4
4.plus 4
$.is
$.anything
"sum of anything is always true"
Expand All @@ -42,7 +42,7 @@

[] > anything-two-floats-sum-test
assert-that > @
4.2.add 3.9
4.2.plus 3.9
$.is
$.anything
"sum of two floats of anything is always true"
Expand Down
2 changes: 1 addition & 1 deletion examples/described-as-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

[] > two-sum-described-as-equal-to-test
assert-that > @
15.add 5
15.plus 5
$.described-as
$.equal-to 20
"this message overrides matchers description, and add values: %s"
Expand Down
4 changes: 2 additions & 2 deletions examples/equal-to-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

[] > two-sum-test
assert-that > @
4.add 4
4.plus 4
$.equal-to 8
"sum of two numbers"

Expand All @@ -40,7 +40,7 @@

[] > two-floats-sum-test
assert-that > @
4.1.add 3.9
4.1.plus 3.9
$.equal-to 8.0
"sum of two floats"

Expand Down
18 changes: 9 additions & 9 deletions examples/greater-than-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@

[] > two-sum-greater-than-value-test
assert-that > @
4.add 4
4.plus 4
$.greater-than 3
"is 4.add 4 greater than 3"
"is 4.plus 4 greater than 3"

[] > two-sub-greater-than-expr-test
assert-that > @
50.sub 3
50.minus 3
$.greater-than
33.add 5
"is 50.sub 3 greater than 33.add 5"
33.plus 5
"is 50.minus 3 greater than 33.plus 5"

[] > two-floats-is-greater-than-value-test
assert-that > @
3.2.add 7.7
3.2.plus 7.7
$.greater-than 4.0
"is 3.2.add 7.7 greater than 4.0"
"is 3.2.plus 7.7 greater than 4.0"

[] > two-floats-is-greater-than-expr-test
assert-that > @
19.1.mul 3.2
19.1.times 3.2
$.greater-than
100.00.div 25.00
"is 19.1.mul 3.2 greater than 100.00.div 25.00"
"is 19.1.times 3.2 greater than 100.00.div 25.00"

14 changes: 7 additions & 7 deletions examples/is-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

[] > is-two-sum-test
assert-that > @
4.add 4
4.plus 4
$.is
$.equal-to 8
"is sum of two numbers "
Expand All @@ -42,7 +42,7 @@

[] > is-two-floats-sum-test
assert-that > @
4.2.add 3.9
4.2.plus 3.9
$.is
$.equal-to 8.1
"is sum of two floats are equal"
Expand All @@ -56,15 +56,15 @@

[] > is-two-sum-greater-than-value-test
assert-that > @
14.add 4
14.plus 4
$.is
$.greater-than 3
"is 14.add 4 greater than 3"
"is 14.plus 4 greater than 3"

[] > is-two-sub-greater-than-expr-test
assert-that > @
44.sub 3
44.minus 3
$.is
$.greater-than
33.add 5
"is 44.sub 3 greater than 33.add 5"
33.plus 5
"is 44.minus 3 greater than 33.plus 5"
18 changes: 9 additions & 9 deletions examples/less-than-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@

[] > two-sum-less-than-value-test
assert-that > @
20.add 13
20.plus 13
$.less-than 100
"is 20.add 13 less than 100"
"is 20.plus 13 less than 100"

[] > two-sub-less-than-expr-test
assert-that > @
33.sub 12
33.minus 12
$.less-than
1.add 64
"is 33.sub 12 less than 1.add 64"
1.plus 64
"is 33.minus 12 less than 1.plus 64"

[] > two-floats-is-less-than-value-test
assert-that > @
13.8.add 17.0
13.8.plus 17.0
$.less-than 114.0
"is 13.8.add 17.0 less than 114.0"
"is 13.8.plus 17.0 less than 114.0"

[] > two-floats-is-less-than-expr-test
assert-that > @
5.5.mul 2.0
5.5.times 2.0
$.less-than
333.00.div 11.00
"is 5.5.mul 2.0 less than 333.00.div 11.00"
"is 5.5.times 2.0 less than 333.00.div 11.00"

10 changes: 5 additions & 5 deletions examples/not-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@

[] > not-equal-two-sum-test
assert-that > @
5.add 10
5.plus 10
$.not
$.equal-to 55
"sum of two numbers"

[] > not-greater-than-two-sum-test
assert-that > @
111.add 89
111.plus 89
$.not
$.greater-than 201
"is 111.add 89 greater than 201"
"is 111.plus 89 greater than 201"

[] > not-equal-two-strings-test
assert-that > @
Expand All @@ -52,9 +52,9 @@
$.not
$.equal-to 18.35

[] > not-greater-than-floats-mul-test
[] > not-greater-than-floats-times-test
assert-that > @
101.35.mul 2.2
101.35.times 2.2
$.not
$.greater-than 250.31

Expand Down
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ SOFTWARE.
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>eo-hamcrest</name>
<properties>
<eolang.version>0.23.11</eolang.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<description>Hamcrest matchers for EOLANG</description>
<url>https://github.com/objectionary/eo-hamcrest</url>
<inceptionYear>2022</inceptionYear>
Expand Down Expand Up @@ -82,7 +87,7 @@ SOFTWARE.
<dependency>
<groupId>org.eolang</groupId>
<artifactId>eo-runtime</artifactId>
<version>0.23.7</version>
<version>${eolang.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -102,7 +107,7 @@ SOFTWARE.
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.23.7</version>
<version>${eolang.version}</version>
<executions>
<execution>
<id>compile</id>
Expand Down
36 changes: 18 additions & 18 deletions src/main/eo/org/eolang/hamcrest/assert-that.eo
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@
count.write 0
while.
and.
count.less (matchers.length)
count.geq 0
count.lt (matchers.length)
count.gte 0
[i]
if. > @
(matchers.get i).match a
count.write (i.add 1)
count.write (i.plus 1)
seq
mismatch.write
describe-mismatch.
matchers.get i
count.write -1
count.greater 0
count.gt 0

[] > describe-mismatch
sprintf > @
Expand All @@ -128,14 +128,14 @@
count.write 0
while.
and.
count.less (matchers.length)
count.geq 0
count.lt (matchers.length)
count.gte 0
[i]
if. > @
(matchers.get i).match a
count.write -1
count.write (i.add 1)
count.less 0
count.write (i.plus 1)
count.lt 0

[] > describe-mismatch
sprintf > @
Expand All @@ -154,7 +154,7 @@
[x] > greater-than

[a] > match
greater. > @
gt. > @
a
x

Expand All @@ -173,7 +173,7 @@
[x] > less-than

[a] > match
less. > @
lt. > @
a
x

Expand All @@ -196,11 +196,11 @@
[a] > match
seq > @
mismatch.write actual-delta
actual-delta.leq 0.0
actual-delta.lte 0.0
[] > actual-delta
sub. > @
minus. > @
abs.
a.sub operand
a.minus operand
err

[] > describe-mismatch
Expand Down Expand Up @@ -298,24 +298,24 @@
memory 0 > mismatches

[a] > all-match
memory > count
memory 0 > count
seq > @
count.write 0
while.
and.
count.less (matchers.length)
count.geq 0
count.lt (matchers.length)
count.gte 0
[i]
if. > @
(matchers.get i).match a
count.write (i.add 1)
count.write (i.plus 1)
seq
mismatches.write
mismatches.with
describe-mismatch.
matchers.get i
count.write -1
count.greater 0
count.gt 0

[a] > match
seq > @
Expand Down
4 changes: 2 additions & 2 deletions src/test/eo/org/eolang/hamcrest/all-of-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

[] > all-of-numbers-test
assert-that > @
150.sub 50
150.minus 50
$.all-of
$.equal-to 100
"all of numbers conditions"

[] > all-of-several
assert-that > @
15.mul 3
15.times 3
$.all-of
$.equal-to 45
$.greater-than 40
Expand Down
Loading

0 comments on commit 7d285da

Please sign in to comment.