FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
testTrim.c
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright (C) 2011 Hewlett-Packard Development Company, L.P.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 version 2 as published by the Free Software Foundation.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16  *********************************************************************/
17 
18 #include <stdio.h>
19 #include "CUnit/CUnit.h"
20 #include <pkgagent.h>
21 
35 {
36  char str[] = " test trim! ";
37  char *predictValue = "test trim!";
38  char *Result = trim(str);
39  //printf("test_Trim_normal Result is:%s\n", Result);
40  CU_ASSERT_TRUE(!strcmp(Result, predictValue));
41 }
42 
51 {
52  char *str = "";
53  char *predictValue = "";
54  char *Result = trim(str);
55  CU_ASSERT_EQUAL(Result, predictValue);
56 }
57 
66 {
67  char *str = " ";
68  char *predictValue = "";
69  char *Result = trim(str);
70  CU_ASSERT_TRUE(!strcmp(Result, predictValue));
71 }
72 
76 CU_TestInfo testcases_Trim[] = {
77  {"Testing Trim, paramters are normal:", test_Trim_normal},
78  {"Testing Trim, paramter is null:", test_Trim_str_is_null},
79  {"Testing Trim, paramter is allspace:", test_Trim_allspace},
80  CU_TEST_INFO_NULL
81 };
82 
static int Result
Result of calls.
Definition: test_CopyFile.c:28
void test_Trim_allspace()
Test case for input parameter is all space.
Definition: testTrim.c:65
void test_Trim_normal()
Test case for input parameter is normal.
Definition: testTrim.c:34
pkgagent header
CU_TestInfo testcases_Trim[]
testcases for function Trim
Definition: testTrim.c:76
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:695
void test_Trim_str_is_null()
Test case for input parameter is null.
Definition: testTrim.c:50