Skip to content

Commit

Permalink
Add tests for the new quantifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
teiesti committed Sep 2, 2024
1 parent 3c26dbe commit 489ace2
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions tests/test_quantifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,87 @@ def test_exact():
(False, True),
(False, True),
]


def test_less():
from clintest.quantifier import Less
quantifier = Less(2)

assert quantifier.outcome().as_tuple() == (True, False)

input = 4 * [False, True]
output = [quantifier.consume(value).as_tuple() for value in input]

assert output == [
(True, False),
(True, False),
(True, False),
(False, True),
(False, True),
(False, True),
(False, True),
(False, True),
]


def test_less_equal():
from clintest.quantifier import LessEqual
quantifier = LessEqual(2)

assert quantifier.outcome().as_tuple() == (True, False)

input = 4 * [False, True]
output = [quantifier.consume(value).as_tuple() for value in input]

assert output == [
(True, False),
(True, False),
(True, False),
(True, False),
(True, False),
(False, True),
(False, True),
(False, True),
]


def test_greater():
from clintest.quantifier import Greater
quantifier = Greater(2)

assert quantifier.outcome().as_tuple() == (False, False)

input = 4 * [False, True]
output = [quantifier.consume(value).as_tuple() for value in input]

assert output == [
(False, False),
(False, False),
(False, False),
(False, False),
(False, False),
(True, True),
(True, True),
(True, True),
]


def test_greater_equal():
from clintest.quantifier import GreaterEqual
quantifier = GreaterEqual(2)

assert quantifier.outcome().as_tuple() == (False, False)

input = 4 * [False, True]
output = [quantifier.consume(value).as_tuple() for value in input]

assert output == [
(False, False),
(False, False),
(False, False),
(True, True),
(True, True),
(True, True),
(True, True),
(True, True),
]

0 comments on commit 489ace2

Please sign in to comment.