def test_file_type(filename):
    """
    Tests whether the given filename is a C++ header or implementation file
    (based on the filename extension.)
    """
    pos = filename.rfind(".")
    if (pos >= 0): ext = filename[pos+1:]
    else: ext = ""

    return ext in ["c", "C", "cpp", "CPP", "c++", "C++", "h", "H", "hpp", "HPP", "h++", "H++"]