def cached_test(runner, cur_f, cache=None):
    """
    Run a test only if this configuration has not been tested before, otherwise read it from the cache
    :param runner: Test runner
    :param cur_f: Enabled features to run the test
    :param cache: Cache in the form of a dictionary indexed by frozensets of enabled features
    :return: Result of the test with enabled features cur_f
    """
    if cache is not None:
        if frozenset(cur_f) in cache:
            return cache[frozenset(cur_f)]
        else:
            cache[frozenset(cur_f)] = runner.run_test(cur_f)
            return cache[frozenset(cur_f)]
    else:
        return runner.run_test(cur_f)