Skip to content

Commit ffcf0b0

Browse files
author
Owen Jones
committed
Added two recency tests and renamed old tests
1 parent 440a0f8 commit ffcf0b0

File tree

4 files changed

+63
-12
lines changed

4 files changed

+63
-12
lines changed
467 Bytes
Binary file not shown.
584 Bytes
Binary file not shown.

regression/LVSA/TestRecency/Test.java

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
public class Test {
44
static Object output;
55

6-
public static void returns_most_recent() {
6+
public static void outputs_most_recent() {
77
output = null;
88
output = new Object();
99
}
1010

11-
public static void returns_most_recent_or_null() {
11+
public static void outputs_most_recent_or_null() {
1212
output = null;
1313
for (int i = 0; i < 5; i++) {
1414
output = new Object();
1515
}
1616
}
1717

18-
public static void returns_most_recent_non_recent_or_null(int unknown) {
18+
public static void outputs_most_recent_non_recent_or_null(int unknown) {
1919
output = null;
2020
for (int i = 0; i < 5; i++) {
2121
Object local = new Object();
@@ -25,12 +25,42 @@ public static void returns_most_recent_non_recent_or_null(int unknown) {
2525
}
2626
}
2727

28-
public static void returns_non_recent_or_null() {
28+
public static void outputs_non_recent_or_null() {
2929
output = null;
3030
Object local = null;
3131
for (int i = 0; i < 5; i++) {
3232
output = local;
3333
local = new Object();
3434
}
3535
}
36+
37+
public class A {
38+
Object b;
39+
}
40+
41+
public void most_recent_gets_strong_update() {
42+
A a = new A();
43+
a.b = null;
44+
a.b = new Object();
45+
output = a.b;
46+
}
47+
48+
public void non_recent_gets_weak_update() {
49+
A a1 = null;
50+
A a2 = null;
51+
52+
for (int i = 0; i < 2; ++i) {
53+
A aInLoop = new A();
54+
if (i == 0) {
55+
a1 = aInLoop;
56+
}
57+
else {
58+
a2 = aInLoop;
59+
}
60+
}
61+
62+
a1.b = null;
63+
a1.b = new Object();
64+
output = a1.b;
65+
}
3666
}

regression/LVSA/TestRecency/test_recency.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
folder_name = 'TestRecency'
55

66

7-
def test_lvsa_returns_most_recent(tmpdir):
8-
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('returns_most_recent')
7+
def test_outputs_most_recent(tmpdir):
8+
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_most_recent')
99
lvsa_expectation = lvsa_driver.run()
1010

1111
output_value_expectation = lvsa_expectation.check_output()
@@ -14,8 +14,8 @@ def test_lvsa_returns_most_recent(tmpdir):
1414
output_value_expectation.check_contains_most_recent_allocation_dynamic_object()
1515

1616

17-
def test_lvsa_returns_most_recent_or_null(tmpdir):
18-
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('returns_most_recent_or_null')
17+
def test_outputs_most_recent_or_null(tmpdir):
18+
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_most_recent_or_null')
1919
lvsa_expectation = lvsa_driver.run()
2020

2121
output_value_expectation = lvsa_expectation.check_output()
@@ -25,8 +25,8 @@ def test_lvsa_returns_most_recent_or_null(tmpdir):
2525
output_value_expectation.check_contains_most_recent_allocation_dynamic_object()
2626

2727

28-
def test_lvsa_returns_most_recent_non_recent_or_null(tmpdir):
29-
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('returns_most_recent_non_recent_or_null')
28+
def test_outputs_most_recent_non_recent_or_null(tmpdir):
29+
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_most_recent_non_recent_or_null')
3030
lvsa_expectation = lvsa_driver.run()
3131

3232
output_value_expectation = lvsa_expectation.check_output()
@@ -37,12 +37,33 @@ def test_lvsa_returns_most_recent_non_recent_or_null(tmpdir):
3737
output_value_expectation.check_contains_non_recent_allocation_dynamic_object()
3838

3939

40-
def test_lvsa_returns_non_recent_or_null(tmpdir):
41-
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('returns_non_recent_or_null')
40+
def test_outputs_non_recent_or_null(tmpdir):
41+
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('outputs_non_recent_or_null')
4242
lvsa_expectation = lvsa_driver.run()
4343

4444
output_value_expectation = lvsa_expectation.check_output()
4545

4646
output_value_expectation.check_number_of_values(2)
4747
output_value_expectation.check_contains_null_object()
4848
output_value_expectation.check_contains_non_recent_allocation_dynamic_object()
49+
50+
51+
def test_most_recent_gets_strong_update(tmpdir):
52+
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('most_recent_gets_strong_update')
53+
lvsa_expectation = lvsa_driver.run()
54+
55+
output_value_expectation = lvsa_expectation.check_output()
56+
57+
output_value_expectation.check_number_of_values(1)
58+
output_value_expectation.check_contains_dynamic_object()
59+
60+
61+
def test_non_recent_gets_weak_update(tmpdir):
62+
lvsa_driver = LvsaDriver(tmpdir, folder_name).with_test_function('non_recent_gets_weak_update')
63+
lvsa_expectation = lvsa_driver.run()
64+
65+
output_value_expectation = lvsa_expectation.check_output()
66+
67+
output_value_expectation.check_number_of_values(2)
68+
output_value_expectation.check_contains_null_object()
69+
output_value_expectation.check_contains_dynamic_object()

0 commit comments

Comments
 (0)