[m-rev.] for review: coverage testing

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Sep 20 15:18:20 AEST 2006


On Wed, 20 Sep 2006, Zoltan Somogyi wrote:

> On 20-Sep-2006, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>> I would prefer a different name for this, mcov for example, mct is
>> too similar to mtc.
>
> I followed this suggestion, as well as all of Ian's suggestions with
> the exception of documentation and a test case (which will come later).
> In the process, I managed to find and fix the bug, so I have actually
> been able to create test coverage output for the compiler itself.
>
> The updated Log file and the interdiff follow. I will commit this diff
> tomorrow after a final bootcheck.

...

> --- /home/zs/mer/ws5/mdbcomp/trace_counts.m	2006-09-18 13:18:18.000000000 +1000
> +++ trace_counts.m	2006-09-19 18:05:56.000000000 +1000

...

> @@ -940,51 +950,58 @@
>
> %-----------------------------------------------------------------------------%
>
> -:- func file_type_to_string(trace_count_file_type) = string.
> -
> -file_type_to_string(single_file(Kind)) =
> -    "single " ++ all_or_nonzero_to_string(Kind).
> -file_type_to_string(union_file(N, Kinds)) =
> -    "union " ++ int_to_string(N)
> -        ++ string.append_list(list.map(all_or_nonzero_to_space_string,
> -            to_sorted_list(Kinds))).
> -file_type_to_string(diff_file) = "diff".
> -
> -:- func all_or_nonzero_to_space_string(all_or_nonzero) = string.
> -
> -all_or_nonzero_to_space_string(Kind) = " " ++ all_or_nonzero_to_string(Kind).
> -
> -:- func all_or_nonzero_to_string(all_or_nonzero) = string.
> -
> -all_or_nonzero_to_string(user_all) = "all".
> -all_or_nonzero_to_string(user_nonzero) = "nonzero".
> -
> -:- pred string_to_all_or_nonzero(string::in, all_or_nonzero::out) is semidet.
> -
> -string_to_all_or_nonzero("all", user_all).
> -string_to_all_or_nonzero("nonzero", user_nonzero).
> -
> -:- pred string_to_file_type(string::in, trace_count_file_type::out) is semidet.
> -
> -string_to_file_type(Str, FileType) :-
> -    Words = string.words(Str),
> -    Words = [Word1 | Rest],
> -    (
> -        Word1 = "union",
> -        Rest = [NumTestsStr | KindStrs],
> -        string.to_int(NumTestsStr, NumTests),
> -        list.map(string_to_all_or_nonzero, KindStrs, Kinds),
> -        FileType = union_file(NumTests, list_to_set(Kinds))
> -    ;
> -        Word1 = "single",
> -        Rest = [KindStr],
> -        string_to_all_or_nonzero(KindStr, Kind),
> -        FileType = single_file(Kind)
> -    ;
> -        Word1 = "diff",
> -        Rest = [],
> -        FileType = diff_file
> -    ).
> +% :- func file_type_to_string(trace_count_file_type) = string.
> +%
> +% file_type_to_string(single_file(
> +% base_count_file_type(Kind, Prog))
> +% ) =
> +%     "single " ++ all_or_nonzero_to_string(Kind) ++
> +%         " " ++ term_io.quoted_atom(Prog).
> +% file_type_to_string(union_file(N, KindsProgs)) =
> +%     "union " ++ int_to_string(N) ++ " { " ++
> +%         string.append_list(list.map(all_or_nonzero_prog_to_space_string,
> +%             to_sorted_list(KindsProgs))) ++ " }".
> +% file_type_to_string(diff_file(Type1, Type2)) =
> +%     "diff [ " ++ file_type_to_string(Type1) ++
> +%     " - " ++ file_type_to_string(Type2) ++ " ]".
> +%
> +% :- func base_count_file_type_to_space_string(base_count_file_type) = string.
> +%
> +% base_count_file_type_to_space_string(base_count_file_type(Kind, Prog)) =
> +%     " " ++ all_or_nonzero_to_string(Kind) ++
> +%     " " ++ term_io.quoted_atom(Prog).
> +%
> +% :- func all_or_nonzero_to_string(all_or_nonzero) = string.
> +%
> +% all_or_nonzero_to_string(user_all) = "all".
> +% all_or_nonzero_to_string(user_nonzero) = "nonzero".
> +%
> +% :- pred string_to_all_or_nonzero(string::in, all_or_nonzero::out) is semidet.
> +%
> +% string_to_all_or_nonzero("all", user_all).
> +% string_to_all_or_nonzero("nonzero", user_nonzero).
> +%
> +% :- pred string_to_file_type(string::in, trace_count_file_type::out) is semidet.
> +%
> +% string_to_file_type(Str, FileType) :-
> +%     Words = string.words(Str),
> +%     Words = [Word1 | Rest],
> +%     (
> +%         Word1 = "union",
> +%         Rest = [NumTestsStr | KindStrs],
> +%         string.to_int(NumTestsStr, NumTests),
> +%         list.map(string_to_all_or_nonzero, KindStrs, Kinds),
> +%         FileType = union_file(NumTests, list_to_set(Kinds))
> +%     ;
> +%         Word1 = "single",
> +%         Rest = [KindStr],
> +%         string_to_all_or_nonzero(KindStr, Kind),
> +%         FileType = single_file(Kind)
> +%     ;
> +%         Word1 = "diff",
> +%         Rest = [],
> +%         FileType = diff_file
> +%     ).

Why is all this code commented out?

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list