from typing import List
from typing import Tuple
from pathlib import Path


def parse_benchfile(f) -> List[Tuple[Path, Path]]:
    """Parse the given file into benchmark cases.

    On each line in the file, there should be a path to a map,
    a colon and a space-separated list of scenarios which should
    be benchmarked for the map. For example:
    `benchmarks/office.map: benchmarks/office1.scen benchmarks/office2.scen benchmarks/office3.scen`
    """
    benchmarks = []
    for l in f:
        trimmed = l.strip()
        if not trimmed:
            continue
        map_file, scen_files = trimmed.split(":")
        for scen_file in scen_files.strip().split(" "):
            benchmarks.append((Path(map_file), Path(scen_file)))
    return benchmarks