diff --git a/tests/sfcf_in_test.py b/tests/sfcf_in_test.py index f92126f9..60a71433 100644 --- a/tests/sfcf_in_test.py +++ b/tests/sfcf_in_test.py @@ -387,3 +387,33 @@ def test_find_correlator(): found_start, found_T = sfin._find_correlator(file, "2.0", "name f_A\nquarks lquark lquark\noffset 0\nwf 0", False, False) assert found_start == 21 assert found_T == 3 + + +def test_get_rep_name(): + names = ['data_r0', 'data_r1', 'data_r2'] + new_names = sfin._get_rep_names(names) + assert len(new_names) == 3 + assert new_names[0] == 'data_|r0' + assert new_names[1] == 'data_|r1' + assert new_names[2] == 'data_|r2' + names = ['data_q0', 'data_q1', 'data_q2'] + new_names = sfin._get_rep_names(names, rep_sep='q') + assert len(new_names) == 3 + assert new_names[0] == 'data_|q0' + assert new_names[1] == 'data_|q1' + assert new_names[2] == 'data_|q2' + + +def test_get_appended_rep_name(): + names = ['data_r0.f_1', 'data_r1.f_1', 'data_r2.f_1'] + new_names = sfin._get_appended_rep_names(names, 'data', 'f_1') + assert len(new_names) == 3 + assert new_names[0] == 'data_|r0' + assert new_names[1] == 'data_|r1' + assert new_names[2] == 'data_|r2' + names = ['data_q0.f_1', 'data_q1.f_1', 'data_q2.f_1'] + new_names = sfin._get_appended_rep_names(names, 'data', 'f_1', rep_sep='q') + assert len(new_names) == 3 + assert new_names[0] == 'data_|q0' + assert new_names[1] == 'data_|q1' + assert new_names[2] == 'data_|q2'