Skip to content

Commit dd320fc

Browse files
committed
add trivial/vm.py
1 parent 22532ea commit dd320fc

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

experiment/trivial/vm.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from checkpoint import persist
2+
3+
4+
def run() -> None:
5+
"""Trivial baseline"""
6+
with persist.SimpleTcpClient("trivial") as client:
7+
for i in client.iterate(range(1000)): # type: int
8+
pass
9+
client.commit()
10+
11+
12+
if __name__ == "__main__":
13+
run()

tests/test_generate.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def naive_transform(filename: pathlib.Path, expected_outfile: pathlib.Path) -> N
2727
compare_transformed_files(actual, expected_outfile)
2828

2929

30-
@pytest.mark.parametrize("experiment_name", ["k_means", "feature_selection", "pivoter"])
30+
@pytest.mark.parametrize(
31+
"experiment_name", ["k_means", "feature_selection", "pivoter", "trivial"]
32+
)
3133
def test_naive_transformation(experiment_name: str) -> None:
3234
exp = pathlib.Path("experiment") / experiment_name
3335
naive_transform(
@@ -43,7 +45,9 @@ def tcp_transform(
4345
compare_transformed_files(actual, expected_outfile)
4446

4547

46-
@pytest.mark.parametrize("experiment_name", ["k_means", "feature_selection", "pivoter"])
48+
@pytest.mark.parametrize(
49+
"experiment_name", ["k_means", "feature_selection", "pivoter", "trivial"]
50+
)
4751
def test_tcp_transformation(experiment_name: str) -> None:
4852
exp = pathlib.Path("experiment") / experiment_name
4953
filename = exp / "main.py"
@@ -96,3 +100,12 @@ def test_pivoter(simplify: bool) -> None:
96100
function_name="run",
97101
simplify=simplify,
98102
)
103+
104+
105+
@pytest.mark.parametrize("simplify", [True, False])
106+
def test_trivial(simplify: bool) -> None:
107+
analyze_and_transform(
108+
experiment_name="trivial",
109+
function_name="run",
110+
simplify=simplify,
111+
)

tests/test_instrument.py

+7
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ def test_pivoter() -> None:
3535
experiment_name="pivoter",
3636
args="--filename=experiment/pivoter/enron.small.edges".split(),
3737
)
38+
39+
40+
def test_trivial() -> None:
41+
instrument_experiment(
42+
experiment_name="trivial",
43+
args=[],
44+
)

0 commit comments

Comments
 (0)