Commit 3a9b42e4 authored by Siebers, Michael's avatar Siebers, Michael
Browse files

extend time tests

parent 60b7f204
......@@ -133,74 +133,158 @@ test(item_base_name_semidet) :-
%% creation_time/2
%%
% creation_time(+Item,-Time) is semidet.
test(creation_time_semidet_true,
% creation_time(+Item, -Time) is semidet.
test(creation_time_unbound_semidet_true,
[forall(theory_bg:item(KnownId))]) :-
creation_time(KnownId, _Time).
test(creation_time_unbound_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
creation_time(UnknownId, _Time).
% creation_time(+Item, -Time) correct
test(creation_time_correct,
[forall(theory_bg:creation_time(ItemId, ExpectedTime)),
true(Time == ExpectedTime)
]) :- creation_time(ItemId, Time).
test(creation_time_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
creation_time(UnknownId, _Time).
% creation_time(+Item, +Time) is semidet.
test(modification_time_bound_semidet_true,
[forall(theory_bg:creation_time(ItemId, ExpectedTime))]) :-
creation_time(ItemId, ExpectedTime).
test(modification_time_bound_semidet_false,
[forall(theory_bg:creation_time(ItemId, ExpectedTime)),
setup(WrongTime is ExpectedTime + 10),
fail]) :-
creation_time(ItemId, WrongTime).
%%
%% modification_time/2
%%
% modification_time(+File,-Time) is semidet.
test(modification_time_semidet_true,
% modification_time(+File, -Time) is semidet.
test(modification_time_unbound_semidet_true, [forall(theory_bg:file(FileId))]) :-
modification_time(FileId, _Time).
test(modification_time_unbound_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
modification_time(UnknownId, _Time).
% modification_time(+File, -Time) correct
test(modification_time_correct,
[forall(theory_bg:modification_time(FileId, ExpectedTime)),
true(Time == ExpectedTime)
]) :- modification_time(FileId, Time).
test(modification_time_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
modification_time(UnknownId, _Time).
% modification_time(+File, +Time) is semidet.
test(modification_time_bound_semidet_true,
[forall(theory_bg:modification_time(FileId, ExpectedTime))]) :-
modification_time(FileId, ExpectedTime).
test(modification_time_bound_semidet_false,
[forall(theory_bg:modification_time(FileId, ExpectedTime)),
setup(WrongTime is ExpectedTime + 10),
fail]) :-
modification_time(FileId, WrongTime).
% modification_time(+Directory, -Size) fails
test(modification_time_fails_for_directory,
[forall(theory_bg:file_false(DirId)), fail]) :-
test(modification_time_fails_for_directory_unbound,
[forall(theory_bg:file_false(DirId)), fail]) :-
modification_time(DirId, _Time).
% modification_time(+Directory, +Size) fails
test(modification_time_fails_for_directory_bound,
[forall((
theory_bg:file_false(DirId),
member(AnyTime, [-123456, 0, 18, 1024, 1700000000])
)),
fail]) :-
modification_time(DirId, AnyTime).
%%
%% access_time/2
%%
% access_time(+File,-Time) is semidet.
test(access_time_semidet_true,
% access_time(+File, -Time) is semidet.
test(access_time_unbound_semidet_true, [forall(theory_bg:file(FileId))]) :-
access_time(FileId, _Time).
test(access_time_unbound_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
access_time(UnknownId, _Time).
% access_time(+File, -Time) correct
test(access_time_correct,
[forall(theory_bg:access_time(FileId, ExpectedTime)),
true(Time == ExpectedTime)
]) :- access_time(FileId, Time).
test(access_time_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
access_time(UnknownId, _Time).
% access_time(+File, +Time) is semidet.
test(access_time_bound_semidet_true,
[forall(theory_bg:access_time(FileId, ExpectedTime))]) :-
access_time(FileId, ExpectedTime).
test(access_time_bound_semidet_false,
[forall(theory_bg:access_time(FileId, ExpectedTime)),
setup(WrongTime is ExpectedTime + 10),
fail]) :-
access_time(FileId, WrongTime).
% access_time(+Directory, -Size) fails
test(access_time_fails_for_directory,
[forall(theory_bg:file_false(DirId)), fail]) :-
test(access_time_fails_for_directory_unbound,
[forall(theory_bg:file_false(DirId)), fail]) :-
access_time(DirId, _Time).
% access_time(+Directory, +Size) fails
test(access_time_fails_for_directory_bound,
[forall((
theory_bg:file_false(DirId),
member(AnyTime, [-123456, 0, 18, 1024, 1700000000])
)),
fail]) :-
access_time(DirId, AnyTime).
%%
%% change_time/2
%%
% change_time(+File,-Time) is semidet.
test(change_time_semidet_true,
% change_time(+File, -Time) is semidet.
test(change_time_unbound_semidet_true, [forall(theory_bg:file(FileId))]) :-
change_time(FileId, _Time).
test(change_time_unbound_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
change_time(UnknownId, _Time).
% change_time(+File, -Time) correct
test(change_time_correct,
[forall(theory_bg:change_time(FileId, ExpectedTime)),
true(Time == ExpectedTime)
]) :- change_time(FileId, Time).
test(change_time_semidet_false,
[forall(theory_bg:item_false(UnknownId)), fail]) :-
change_time(UnknownId, _Time).
% change_time(+File, +Time) is semidet.
test(change_time_bound_semidet_true,
[forall(theory_bg:change_time(FileId, ExpectedTime))]) :-
change_time(FileId, ExpectedTime).
test(change_time_bound_semidet_false,
[forall(theory_bg:change_time(FileId, ExpectedTime)),
setup(WrongTime is ExpectedTime + 10),
fail]) :-
change_time(FileId, WrongTime).
% change_time(+Directory, -Size) fails
test(change_time_fails_for_directory,
[forall(theory_bg:file_false(DirId)), fail]) :-
test(change_time_fails_for_directory_unbound,
[forall(theory_bg:file_false(DirId)), fail]) :-
change_time(DirId, _Time).
% change_time(+Directory, +Size) fails
test(change_time_fails_for_directory_bound,
[forall((
theory_bg:file_false(DirId),
member(AnyTime, [-123456, 0, 18, 1024, 1700000000])
)),
fail]) :-
change_time(DirId, AnyTime).
%%
%% newer/2
%%
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment