[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 10:59:25PM -0600, William Torrez Corea wrote:
> > 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+"))){
>       |          ^~

The code you're tryhing to compile is not written correctly.  You'll
have to take this up with whoever wrote it.

In this particular line of code, my guess is the second == was supposed
to be = instead, to assign the result of fopen to the variable temp_file.

> 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, ""));
>       |                                     ^~

I have no idea what this code is even trying to do.  "Simulate a write
but without any actual data, just to make sure the file descriptor
still exists"?!  Why would that even be a thing?

> cunit.c: At top level:
> cunit.c:75:31: warning: "/*" within comment [-Wcomment]
>    75 |  * Reads the data previously w/*
>       |

Funny.

> cunit.c:107:14: error: redefinition of ‘temp_file’
>   107 | static FILE* temp_file = NULL;
>       |              ^~~~~~~~~

This, I cannot diagnose without digging through the whole source tree.

Remainder snipped.  The debian-user mailing list is not the place to
get help fixing a broken C or C++ program.  Please take it up with
the author or maintainer.


Reply to: