FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
test_hash.c
1 /*
2 Author: Daniele Fognini, Andreas Wuerl
3 Copyright (C) 2013-2014, Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 #include <stdlib.h>
19 #include <stdio.h>
20 #include <CUnit/CUnit.h>
21 
22 #include "hash.h"
23 
24 void test_hash1() {
25  CU_ASSERT_NOT_EQUAL(hash(""), hash("t"));
26  CU_ASSERT_NOT_EQUAL(hash("t"), hash("test"));
27  CU_ASSERT_NOT_EQUAL(hash("test"), hash("test1"));
28 }
29 
30 void test_hash2() {
31  CU_ASSERT_EQUAL(hash("a\0b"), hash("a"));
32 }
33 
34 CU_TestInfo hash_testcases[] = {
35  {"Testing extracting Hash test1:", test_hash1},
36  {"Testing extracting Hash test2:", test_hash2},
37  CU_TEST_INFO_NULL
38 };