Commit 0914bdc1 authored by Siebers, Michael's avatar Siebers, Michael
Browse files

fix exception in modification_time/2

add unit test
parent cf8dff21
...@@ -134,7 +134,7 @@ change_time(Item,Time) :- theory_bg:item(Item, Dict), !, ...@@ -134,7 +134,7 @@ change_time(Item,Time) :- theory_bg:item(Item, Dict), !,
% %
% Returns the modification time of the item. % Returns the modification time of the item.
modification_time(Item,Time) :- theory_bg:item(Item, Dict), !, modification_time(Item,Time) :- theory_bg:item(Item, Dict), !,
Time=Dict.modification_time. Time=Dict.get(modification_time).
%! access_time(++Item, -Timestamp) is semidet. %! access_time(++Item, -Timestamp) is semidet.
% %
......
...@@ -49,10 +49,12 @@ test(abs_path_semidet) :- ...@@ -49,10 +49,12 @@ test(abs_path_semidet) :-
test(file_size_semibound, forall(theory_bg:file_size(TrueFileId,TrueSize))) :- test(file_size_semibound, forall(theory_bg:file_size(TrueFileId,TrueSize))) :-
first_bound(file_size/2, [TrueFileId, TrueSize]). first_bound(file_size/2, [TrueFileId, TrueSize]).
% file_fize(+File, -Size) det if file is known, false else % file_size(+File, -Size) det if file is known, false else
test(file_size_semidet) :- test(file_size_semidet) :-
semidet_for_file(file_size/2). semidet_for_file(file_size/2).
%% %%
%% directory/1 %% directory/1
%% %%
...@@ -153,14 +155,19 @@ test(creation_time_semidet) :- ...@@ -153,14 +155,19 @@ test(creation_time_semidet) :-
% access_time(+File, -Time) det if file is known, false else % access_time(+File, -Time) det if file is known, false else
% change_time(+File, -Time) det if file is known, false else % change_time(+File, -Time) det if file is known, false else
% modification_time(+File, -Time) det if file is known, false else % modification_time(+File, -Time) det if file is known, false else
test(creation_time_semidet, forall(member(TimePred, [ test(other_time_semidet, forall(member(TimePred, [
access_time, access_time,
change_time, change_time,
modification_time modification_time
])) ]))
) :- ) :-
semidet_for_file(TimePred/2). semidet_for_file(TimePred/2).
% modification_time(+Directory, -Size) fails
test(modification_time_fails_for_directory,
[forall(theory_bg:file_false(DirId)), fail]) :-
modification_time(DirId, _Time).
%% %%
%% newer/2 %% 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