tests/sfversion.c : Test function sf_version_string.

This commit is contained in:
Erik de Castro Lopo 2009-03-17 14:11:18 +11:00
parent ee663d829f
commit cf4859c221
3 changed files with 18 additions and 2 deletions

View File

@ -87,3 +87,7 @@ tests/utils.c
tests/utils.h
tests/write_read_test.c
tests/test_wrapper.sh
doc/AUTHORS
doc/ChangeLog
doc/NEWS
doc/README

View File

@ -10,6 +10,9 @@
* src/sndfile.c src/sndfile.h.in src/create_symbols_file.py
Add public function sf_version_string.
* tests/sfversion.c
Test function sf_version_string.
2009-03-15 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/common.h src/caf.c src/sndfile.c

View File

@ -19,6 +19,7 @@
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
@ -29,11 +30,19 @@
#define BUFFER_SIZE (256)
static char strbuffer [BUFFER_SIZE] ;
int
main (void)
{ sf_command (NULL, SFC_GET_LIB_VERSION, strbuffer, sizeof (strbuffer)) ;
{ static char strbuffer [BUFFER_SIZE] ;
const char * ver ;
sf_command (NULL, SFC_GET_LIB_VERSION, strbuffer, sizeof (strbuffer)) ;
ver = sf_version_string () ;
if (strcmp (ver, strbuffer) != 0)
{ printf ("Version mismatch : '%s' != '%s'\n\n", ver, strbuffer) ;
exit (1) ;
} ;
printf ("%s", strbuffer) ;