/*   maildir_conditions
     Author: GimÃ©nez, Christian.

     Copyright (C) 2016 GimÃ©nez, Christian

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or
     at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

     04 dic 2016
*/


:- module(maildir_conditions_tests, [	      
	  ]).
/** <module> maildir_conditions: Tests for conditions.pl

@author Gimenez, Christian
@license GPLv3
*/

:- license(gplv3).

:- begin_tests('maildir/conditions').
:- use_module('../prolog/maildir/conditions').


test(to_substr) :-
    to_substr(`tohost`, './mail-simple').

test(from_substr) :-
    from_substr(`fromhost`, './mail-simple').

test(subject_substr) :-
    subject_substr(`part`, './mail-simple').

test(older_than) :-
    older_than(date(2015, 12, 9, 17, 28, 50, 10800, -, -),
	       './mail-simple'),
    \+ older_than(date(2015, 12, 9, 17, 27, 50, 10800, -, -),
		  './mail-simple'),
    \+ older_than(date(2015, 12, 9, 17, 00, 50, 10800, -, -),
		  './mail-simple').
    
test(is_seen) :-
    is_seen('~/Maildir/cur/hi_world:2,PRS'),
    \+ is_seen('~/Maildir/new/hi_world:2,PRS'),
    \+ is_seen('~/Maildir/cur/hi_world:2,PR').

:- end_tests('maildir/conditions').
