Skip to content

Commit

Permalink
add trivial/vm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
elazarg committed Aug 6, 2024
1 parent 22532ea commit dd320fc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
13 changes: 13 additions & 0 deletions experiment/trivial/vm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from checkpoint import persist


def run() -> None:
"""Trivial baseline"""
with persist.SimpleTcpClient("trivial") as client:
for i in client.iterate(range(1000)): # type: int
pass
client.commit()


if __name__ == "__main__":
run()
17 changes: 15 additions & 2 deletions tests/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def naive_transform(filename: pathlib.Path, expected_outfile: pathlib.Path) -> N
compare_transformed_files(actual, expected_outfile)


@pytest.mark.parametrize("experiment_name", ["k_means", "feature_selection", "pivoter"])
@pytest.mark.parametrize(
"experiment_name", ["k_means", "feature_selection", "pivoter", "trivial"]
)
def test_naive_transformation(experiment_name: str) -> None:
exp = pathlib.Path("experiment") / experiment_name
naive_transform(
Expand All @@ -43,7 +45,9 @@ def tcp_transform(
compare_transformed_files(actual, expected_outfile)


@pytest.mark.parametrize("experiment_name", ["k_means", "feature_selection", "pivoter"])
@pytest.mark.parametrize(
"experiment_name", ["k_means", "feature_selection", "pivoter", "trivial"]
)
def test_tcp_transformation(experiment_name: str) -> None:
exp = pathlib.Path("experiment") / experiment_name
filename = exp / "main.py"
Expand Down Expand Up @@ -96,3 +100,12 @@ def test_pivoter(simplify: bool) -> None:
function_name="run",
simplify=simplify,
)


@pytest.mark.parametrize("simplify", [True, False])
def test_trivial(simplify: bool) -> None:
analyze_and_transform(
experiment_name="trivial",
function_name="run",
simplify=simplify,
)
7 changes: 7 additions & 0 deletions tests/test_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ def test_pivoter() -> None:
experiment_name="pivoter",
args="--filename=experiment/pivoter/enron.small.edges".split(),
)


def test_trivial() -> None:
instrument_experiment(
experiment_name="trivial",
args=[],
)

0 comments on commit dd320fc

Please sign in to comment.