10

I'm looking for a testsuite for the C Standard Library (mainly for the algorithms not contacting the "outer world", so strcpy(), memcmp(), itoa() & likes).

I tried downloading the GCC sources, but they're very large and I have trouble finding anything I could reuse in there...

(To be clear, the question is meant about the ANSI C Standard Library, not POSIX or else. Also, I'd like for the tests to be rather portable.)

akavel
  • 4,789
  • 1
  • 35
  • 66
  • 3
    Probably you are looking in the wrong place, you have to look into the glibc sources ([here](http://sourceware.org/git/?p=glibc.git;a=tree) the GIT repository). As far as I can see the tests (files beginning with `tst-` or `test-`) are scattered around in the various directories, near the implementation of the functions they test. – Matteo Italia Aug 27 '12 at 23:16
  • thanks; still, they look highly convoluted at first glance (browsed the `string` subdir), so hard to verify what they actually do/test; also `test-string.h` for example seems to reference `mmap()`, so doesn't look portable and "universal", unfortunately. – akavel Aug 27 '12 at 23:27
  • That's why I posted it as a comment and not as an answer :) – Matteo Italia Aug 27 '12 at 23:28
  • @akavel When you say portable - what do you mean? glibc compiles on many platforms as do the tests. – Adrian Cornish Aug 28 '12 at 01:15
  • I am curious to know the purpose of your asking for the test suite for C Standard Library. – Jay Aug 28 '12 at 01:59
  • @Jay: https://github.com/akavel/gostdc – akavel Aug 28 '12 at 20:10
  • @akavel Looks interesting; I would suggest writing in the README not only the instructions, but also what it is and why would someone want to use it. – jpa Aug 29 '12 at 06:05
  • @jpa: wrote some quick intro, thx. Is it readable? The project is mostly a side effect of developing https://github.com/akavel/goluago (although a planned one). – akavel Aug 31 '12 at 09:07
  • For the compiler: http://stackoverflow.com/questions/1104922/compiler-test-cases-or-how-to-test-a-compiler – Ciro Santilli OurBigBook.com Jun 03 '15 at 10:08

1 Answers1

3

The public domain C library has quite simple test cases, which are embedded in each source code file. For example: memcpy, strtol

Newlib has test cases organized as a test suite. They are more complex, but not nearly all functions are covered: memcpy

jpa
  • 10,351
  • 1
  • 28
  • 45