Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #247750 > unrolled thread

CUnit - A Unit Testing Framework for C

Started byWilliam Torrez Corea <willitc9888@gmail.com>
First post2022-04-30 05:10 +0200
Last post2022-04-30 13:40 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.debian.user


Contents

  CUnit - A Unit Testing Framework for C William Torrez Corea <willitc9888@gmail.com> - 2022-04-30 05:10 +0200
    Re: CUnit - A Unit Testing Framework for C Greg Wooledge <greg@wooledge.org> - 2022-04-30 05:20 +0200
      Re: CUnit - A Unit Testing Framework for C William Torrez Corea <willitc9888@gmail.com> - 2022-04-30 07:10 +0200
        Re: CUnit - A Unit Testing Framework for C Greg Wooledge <greg@wooledge.org> - 2022-04-30 13:40 +0200

#247750 — CUnit - A Unit Testing Framework for C

FromWilliam Torrez Corea <willitc9888@gmail.com>
Date2022-04-30 05:10 +0200
SubjectCUnit - A Unit Testing Framework for C
Message-ID<EhLEB-c8lP-5@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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"
>       |          ^~~~~~~~~~~~~~~
> compilation terminated.
>


-- 

With kindest regards, William.

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

[toc] | [next] | [standalone]


#247751

FromGreg Wooledge <greg@wooledge.org>
Date2022-04-30 05:20 +0200
Message-ID<EhLOh-c8p5-5@gated-at.bofh.it>
In reply to#247750
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

[toc] | [prev] | [next] | [standalone]


#247753

FromWilliam Torrez Corea <willitc9888@gmail.com>
Date2022-04-30 07:10 +0200
Message-ID<EhNwK-c9xW-5@gated-at.bofh.it>
In reply to#247751

[Multipart message — attachments visible in raw view] — view raw

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
⠈⠳⣄⠀⠀⠀⠀

[toc] | [prev] | [next] | [standalone]


#247757

FromGreg Wooledge <greg@wooledge.org>
Date2022-04-30 13:40 +0200
Message-ID<EhTCa-cd0f-7@gated-at.bofh.it>
In reply to#247753
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web