[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: CUnit - A Unit Testing Framework for C




On Fri, Apr 29, 2022 at 9:14 PM Greg Wooledge <greg@wooledge.org> wrote:
On Fri, Apr 29, 2022 at 09:00:12PM -0600, William Torrez Corea wrote:
> I install the library CUnit but I don't know how compile the program:
>
> cunit.c:30:10: fatal error: CUnit/Basic.h: No such file or directory
> >    30 | #include "CUnit/Basic.h"

https://packages.debian.org/search?searchon=contents&keywords=CUnit%2FBasic.h&mode=path&suite=stable&arch=any

I get the following error:

cunit.c: In function ‘init_suite1’:
cunit.c:39:10: warning: comparison between pointer and integer
   39 |  if(NULL == (temp_file == fopen("temp.txt","w+"))){
      |          ^~
In file included from /usr/include/CUnit/Basic.h:36,
                 from cunit.c:30:
cunit.c: In function ‘testFPRINTF’:
cunit.c:68:37: warning: zero-length gnu_printf format string [-Wformat-zero-length]
   68 |   CU_ASSERT(0 == fprintf(temp_file, ""));
      |                                     ^~
cunit.c: At top level:
cunit.c:75:31: warning: "/*" within comment [-Wcomment]
   75 |  * Reads the data previously w/*
      |                                
cunit.c:107:14: error: redefinition of ‘temp_file’
  107 | static FILE* temp_file = NULL;
      |              ^~~~~~~~~
cunit.c:33:14: note: previous definition of ‘temp_file’ was here
   33 | static FILE* temp_file = NULL;
      |              ^~~~~~~~~
cunit.c:113:5: error: redefinition of ‘init_suite1’
  113 | int init_suite1(void)
      |     ^~~~~~~~~~~
cunit.c:38:5: note: previous definition of ‘init_suite1’ was here
   38 | int init_suite1(void){
      |     ^~~~~~~~~~~
cunit.c:127:5: error: redefinition of ‘clean_suite1’
  127 | int clean_suite1(void)
      |     ^~~~~~~~~~~~
cunit.c:50:5: note: previous definition of ‘clean_suite1’ was here
   50 | int clean_suite1(void){
      |     ^~~~~~~~~~~~
cunit.c:142:6: error: redefinition of ‘testFPRINTF’
  142 | void testFPRINTF(void)
      |      ^~~~~~~~~~~
cunit.c:64:6: note: previous definition of ‘testFPRINTF’ was here
   64 | void testFPRINTF(void){
      |      ^~~~~~~~~~~
In file included from /usr/include/CUnit/Basic.h:36,
                 from cunit.c:30:
cunit.c: In function ‘testFPRINTF’:
cunit.c:147:41: warning: zero-length gnu_printf format string [-Wformat-zero-length]
  147 |       CU_ASSERT(0 == fprintf(temp_file, ""));
      |                                         ^~
cunit.c: In function ‘testFREAD’:
cunit.c:165:30: warning: pointer targets in passing argument 1 of ‘strncmp’ differ in signedness [-Wpointer-sign]
  165 |       CU_ASSERT(0 == strncmp(buffer, "Q\ni1 = 10", 9));
      |                              ^~~~~~
      |                              |
      |                              unsigned char *
In file included from cunit.c:29:
/usr/include/string.h:140:33: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
  140 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
      |                     ~~~~~~~~~~~~^~~~
cunit.c: At top level:
cunit.c:204:6: error: redefinition of ‘testFREAD’
  204 | void testFREAD(void){
      |      ^~~~~~~~~
cunit.c:158:6: note: previous definition of ‘testFREAD’ was here
  158 | void testFREAD(void)
      |      ^~~~~~~~~
In file included from /usr/include/CUnit/Basic.h:36,
                 from cunit.c:30:
cunit.c: In function ‘testFREAD’:
cunit.c:210:26: warning: pointer targets in passing argument 1 of ‘strncmp’ differ in signedness [-Wpointer-sign]
  210 |   CU_ASSERT(0 == strncmp(buffer,"Q\ni1 = 10",9));
      |                          ^~~~~~
      |                          |
      |                          unsigned char *
In file included from cunit.c:29:
/usr/include/string.h:140:33: note: expected ‘const char *’ but argument is of type ‘unsigned char *’
  140 | extern int strncmp (const char *__s1, const char *__s2, size_t __n)
      |                     ~~~~~~~~~~~~^~~~
cunit.c: At top level:
cunit.c:218:5: error: redefinition of ‘main’
  218 | int main(){
      |     ^~~~
cunit.c:173:5: note: previous definition of ‘main’ was here
  173 | int main()
      |     ^~~~

--
With kindest regards, William.

⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀ 

Reply to: