Add tests from random-value generation of primitives
@@ -189,3 +189,27 @@ def test_primitive_statement_equals_clone(statement_type, value):
def test_primitive_statement_hash(statement_type, value):
statement = statement_type(MagicMock(tc.TestCase), value)
assert statement.__hash__() != 0
+
+
+def test_int_primitive_statement_randomize_value(test_case_mock):
+ statement = prim.IntPrimitiveStatement(test_case_mock)
+ statement.randomize_value()
+ assert -100 <= statement.value < 100
+
+
+def test_float_primitive_statement_randomize_value(test_case_mock):
+ statement = prim.FloatPrimitiveStatement(test_case_mock)
+ statement.randomize_value()
+ assert -100 <= statement.value < 100
+
+
+def test_bool_primitive_statement_randomize_value(test_case_mock):
+ statement = prim.BooleanPrimitiveStatement(test_case_mock)
+ statement.randomize_value()
+ assert statement.value or not statement.value
+
+
+def test_string_primitive_statement_randomize_value(test_case_mock):
+ statement = prim.StringPrimitiveStatement(test_case_mock)
+ statement.randomize_value()
+ assert 1 <= len(statement.value) < 100
