def check_results(results, expected):
    """
    Compare the two MoonLight results dictionaries: one from
    moonlight_solution.json and the other from the execpted result.
    """
    # Mapping of result keys to their data types
    keys_to_compare = dict(corpus_size=int,
                           solution_size=int,
                           solution_weight=float,
                           initial_singularities=int,
                           num_basic_blocks=int,
                           solution=set)
    passed = True
    fail_msg = ''

    for key, type_ in keys_to_compare.items():
        results_value = type_(results[key])
        expected_value = type_(expected[key])

        if results_value != expected_value:
            fail_msg = '{}\n    {}: {} v {}'.format(fail_msg,
                                                    key,
                                                    expected_value,
                                                    results_value)
            passed = False

    if passed:
        print('PASSED')
    else:
        print('FAILED {}'.format(fail_msg))

    return passed