/* imf_tests
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 .
04 dic 2016
*/
:- module(imf_tests, [
]).
/** imf_tests: Tests for IMF.
@author Gimenez, Christian
@license GPLv3
*/
:- license(gplv3).
:- begin_tests(imf).
:- use_module('../prolog/imf').
test(message) :-
read_file_to_codes('./mail-simple', Codes, []),
message(message(header(
[field(`From`, `from@fromhost.com`),
field(`To`, `to@tohost.com`),
field(`Subject`,`Subject part`),
field(`Date`,`Wed, 9 Dec 2015 17:27:50 -0300 (ART)`)]),
body(`Hi world\n`)),
Codes, []).
test(header_field) :-
header_field(`Subject`, `Hola mundo como estás?`, `Subject: Hola mundo\n\tcomo estás?\n`, []).
test(folded_string) :-
folded_string(`Hola mundo como estás?`, `Hola mundo\n\tcomo\n estás?`, []).
test(imf_parse_file) :-
imf_parse_file('./mail-simple',
message(header(
[field("From", "from@fromhost.com"),
field("To", "to@tohost.com"),
field("Subject","Subject part"),
field("Date","Wed, 9 Dec 2015 17:27:50 -0300 (ART)")]),
body("Hi world\n"))
).
test(date_time) :-
imf:date_time(date(2017, 11, 6, 19, 10, 07, 10800, -, -), `Mon, 6 Nov 2017 19:10:07 -0300`, []),
imf:date_time(date(2015, 12, 9, 17, 27, 50, 10800, -, -) ,`Wed, 09 Dec 2015 17:27:50 -0300`, []).
:- end_tests(imf).