Commits

Chris Reuter  committed 977f38b

Test case for new version code.

This adds a simple test of the version API functions.

  • Participants
  • Parent commits 30c9651

Comments (0)

Files changed (3)

 /tests/gdimagerectangle/bug00106_gdimagerectangle
 /tests/gd/gd_null
 /tests/gd/gd_num_colors
+/tests/gd/gd_versiontest
 /tests/tga/tga_null
 /tests/gdimagepixelate/gdimagepixelate
 /tests/gdimagecopy/bug00007

File tests/Makefile.am

 	gif/bug00227 \
 	bmp/bmp_null \
 	gdinterpolatedscale/gdTrivialResize \
-	gdinterpolatedscale/gdModesAndPalettes
+	gdinterpolatedscale/gdModesAndPalettes \
+	gd/gd_versiontest
 
 EXTRA_PROGRAMS = \
 	gdimagestringft/gdimagestringft_bbox \
 	freetype/bug00132
 endif
 
-LDADD = ../src/libgd.la libgdtest.a
+LDADD = libgdtest.a ../src/libgd.la
 AM_CPPFLAGS = -I$(top_srcdir)/src -I $(top_srcdir)/tests/gdtest
 
 TESTS = $(check_PROGRAMS)

File tests/gd/gd_versiontest.c

+#include <string.h>
+
+#include "gd.h"
+#include "gdtest.h"
+
+
+int main()
+{
+    char buffer[100];
+
+    gdTestAssert(GD_MAJOR_VERSION == gdMajorVersion());
+    gdTestAssert(GD_MINOR_VERSION == gdMinorVersion());
+    gdTestAssert(GD_RELEASE_VERSION == gdReleaseVersion());
+    gdTestAssert(strcmp(GD_EXTRA_VERSION, gdExtraVersion()) == 0);
+
+    snprintf(buffer, sizeof(buffer), "%d.%d.%d%s", GD_MAJOR_VERSION, GD_MINOR_VERSION,
+             GD_RELEASE_VERSION, GD_EXTRA_VERSION);
+    gdTestAssert(strcmp(GD_VERSION_STRING, gdVersionString()) == 0);
+
+    return gdNumFailures();
+}