FOSSology  4.4.0
Open Source License Compliance by Open Source Software
test_hash.c
1 /*
2  Author: Daniele Fognini, Andreas Wuerl
3  SPDX-FileCopyrightText: © 2013-2014 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <CUnit/CUnit.h>
11 
12 #include "hash.h"
13 
14 void test_hash1() {
15  CU_ASSERT_NOT_EQUAL(hash(""), hash("t"));
16  CU_ASSERT_NOT_EQUAL(hash("t"), hash("test"));
17  CU_ASSERT_NOT_EQUAL(hash("test"), hash("test1"));
18 }
19 
20 void test_hash2() {
21  CU_ASSERT_EQUAL(hash("a\0b"), hash("a"));
22 }
23 
24 CU_TestInfo hash_testcases[] = {
25  {"Testing extracting Hash test1:", test_hash1},
26  {"Testing extracting Hash test2:", test_hash2},
27  CU_TEST_INFO_NULL
28 };