~maelkum/viuavm

c80226d8e17d3cec16b52ca69fa672861b2f7a30 — Marek Marecki 9 months ago e4cf5c5
Handle two-case runs better

"Handle better" in this case means "don't crash".
1 files changed, 7 insertions(+), 0 deletions(-)

M new/tests/suite.py
M new/tests/suite.py => new/tests/suite.py +7 -0
@@ 1539,6 1539,13 @@ def main(args):
    )
    run_times = sorted(run_times)
    middle = len(run_times) // 2

    # If we have only run two cases, we need to handle it with extra care. Otherwise, the
    # code will crash later when it tries to access index 2 in a two-element list during
    # median calculation.
    if middle == 1:
        middle = 0

    print(
        "median run time was {}".format(
            colorise(