Skip to content

Commit

Permalink
Add test for bigger maps
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Dec 3, 2024
1 parent 486a9ec commit 82f67d2
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/test_oracles_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,47 @@ def test_smaller_map_is_not_accepted(tmp_path: Path, pytestconfig: pytest.Config
assert result.result.enum == Status.WRONG


def test_bigger_map_is_not_accepted(tmp_path: Path, pytestconfig: pytest.Config):
channel = ValueOutputChannel(
value=ObjectType(
type=BasicObjectTypes.MAP,
data=[
ObjectKeyValuePair(
key=StringType(type=BasicStringTypes.TEXT, data="a"),
value=StringType(type=BasicStringTypes.TEXT, data="b"),
),
ObjectKeyValuePair(
key=StringType(type=BasicStringTypes.TEXT, data="c"),
value=StringType(type=BasicStringTypes.TEXT, data="d"),
),
],
)
)

actual_value = get_converter().dumps(
ObjectType(
type=BasicObjectTypes.MAP,
data=[
ObjectKeyValuePair(
key=StringType(type=BasicStringTypes.TEXT, data="a"),
value=StringType(type=BasicStringTypes.TEXT, data="b"),
),
ObjectKeyValuePair(
key=StringType(type=BasicStringTypes.TEXT, data="c"),
value=StringType(type=BasicStringTypes.TEXT, data="d"),
),
ObjectKeyValuePair(
key=StringType(type=BasicStringTypes.TEXT, data="b"),
value=StringType(type=BasicStringTypes.TEXT, data="d"),
),
],
)
)
config = oracle_config(tmp_path, pytestconfig, language="javascript")
result = evaluate_value(config, channel, actual_value)
assert result.result.enum == Status.WRONG


def test_exact_map_is_accepted(tmp_path: Path, pytestconfig: pytest.Config):
channel = ValueOutputChannel(
value=ObjectType(
Expand Down

0 comments on commit 82f67d2

Please sign in to comment.