2
* Phishing module test.
4
* Copyright (C) 2006 T�r�k Edvin <edwintorok@gmail.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27
static struct url_test {
34
/*static int url_tests_cnt = sizeof(url_tests)/sizeof(url_tests[0]);*/
35
static int url_tests_i=-1;
37
struct cl_engine engine;
38
static void url_tests_setup(void)
40
phishing_init(&engine);
44
static void url_tests_teardown(void)
46
phishing_done(&engine);
49
static int url_test_function(const char* input)
51
return isURL(engine.phishcheck,input);
54
START_TEST(url_test_create)
56
fail_unless( url_test_function("")!=-1,
57
"Initialization failed");
62
START_TEST(url_test_##x)\
64
const int url_test_nr = (x);\
65
struct url_test test = url_tests[url_test_nr];\
66
const int output = url_test_function(test.input);\
67
const int expectedoutput = test.output;\
68
char failed_msg[512];\
69
snprintf(failed_msg,sizeof(failed_msg),"Failed at test:%d",url_test_nr);\
70
fail_unless(output==expectedoutput,failed_msg);\
78
#define ADD_URL_TEST(x) tcase_add_test(tc_core, url_test_##x)
80
TCase* create_url_testcase(void)
82
TCase* tc_core = tcase_create("Core");
83
tcase_add_test(tc_core, url_test_create);
87
tcase_add_checked_fixture(tc_core, url_tests_setup, url_tests_teardown);