diff --git a/tests/test_quantifier.py b/tests/test_quantifier.py index 2b9e953..a6909b8 100644 --- a/tests/test_quantifier.py +++ b/tests/test_quantifier.py @@ -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), + ]