FOSSology  4.4.0
Open Source License Compliance by Open Source Software
testTrim.c
Go to the documentation of this file.
1 /*
2  SPDX-FileCopyrightText: © 2011 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 #include <stdio.h>
8 #include "CUnit/CUnit.h"
9 #include <pkgagent.h>
10 
24 {
25  char str[] = " test trim! ";
26  char *predictValue = "test trim!";
27  char *Result = trim(str);
28  //printf("test_Trim_normal Result is:%s\n", Result);
29  CU_ASSERT_TRUE(!strcmp(Result, predictValue));
30 }
31 
40 {
41  char *str = "";
42  char *predictValue = "";
43  char *Result = trim(str);
44  CU_ASSERT_EQUAL(Result, predictValue);
45 }
46 
55 {
56  char *str = " ";
57  char *predictValue = "";
58  char *Result = trim(str);
59  CU_ASSERT_TRUE(!strcmp(Result, predictValue));
60 }
61 
65 CU_TestInfo testcases_Trim[] = {
66  {"Testing Trim, paramters are normal:", test_Trim_normal},
67  {"Testing Trim, paramter is null:", test_Trim_str_is_null},
68  {"Testing Trim, paramter is allspace:", test_Trim_allspace},
69  CU_TEST_INFO_NULL
70 };
71 
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:690
pkgagent header
void test_Trim_str_is_null()
Test case for input parameter is null.
Definition: testTrim.c:39
void test_Trim_normal()
Test case for input parameter is normal.
Definition: testTrim.c:23
void test_Trim_allspace()
Test case for input parameter is all space.
Definition: testTrim.c:54
CU_TestInfo testcases_Trim[]
testcases for function Trim
Definition: testTrim.c:65
static int Result
Result of calls.
Definition: test_CopyFile.c:17