Quellcode durchsuchen

update tests and project files for stb_ds

Sean Barrett vor 6 Jahren
Ursprung
Commit
e704ed0efb
7 geänderte Dateien mit 44 neuen und 26 gelöschten Zeilen
  1. 4 0
      tests/image_test.c
  2. 4 0
      tests/image_test.dsp
  3. 18 11
      tests/image_write_test.c
  4. 13 1
      tests/stb.dsp
  5. 0 12
      tests/stb.dsw
  6. 3 2
      tests/test_c_compilation.c
  7. 2 0
      tests/test_cpp_compilation.cpp

+ 4 - 0
tests/image_test.c

@@ -62,11 +62,15 @@ void dummy_write(void *context, void *data, int len)
    memcpy(dummy, data, len);
 }
 
+extern void image_write_test(void);
+
 int main(int argc, char **argv)
 {
    int w,h;
    //test_ycbcr();
 
+   image_write_test();
+
    #if 0
    // test hdr asserts
    for (h=0; h < 100; h += 2)

+ 4 - 0
tests/image_test.dsp

@@ -88,6 +88,10 @@ SOURCE=.\image_test.c
 # End Source File
 # Begin Source File
 
+SOURCE=.\image_write_test.c
+# End Source File
+# Begin Source File
+
 SOURCE=..\stb_image.h
 # End Source File
 # Begin Source File

+ 18 - 11
tests/image_write_test.c

@@ -1,3 +1,4 @@
+#define STB_IMAGE_WRITE_STATIC
 #define STB_IMAGE_WRITE_IMPLEMENTATION
 #include "stb_image_write.h"
 
@@ -13,7 +14,7 @@ static const char img6x5_template[] =
    ".*...."
    ".*....";
 
-int main(int argc, char **argv)
+void image_write_test(void)
 {
    // make a RGB version of the template image
    // use red on blue to detect R<->B swaps
@@ -32,19 +33,25 @@ int main(int argc, char **argv)
       img6x5_rgbf[i*3 + 2] = on ? 0.0f : 1.0f;
    }
 
-   stbi_write_png("wr6x5_regular.png", 6, 5, 3, img6x5_rgb, 6*3);
-   stbi_write_bmp("wr6x5_regular.bmp", 6, 5, 3, img6x5_rgb);
-   stbi_write_tga("wr6x5_regular.tga", 6, 5, 3, img6x5_rgb);
-   stbi_write_jpg("wr6x5_regular.jpg", 6, 5, 3, img6x5_rgb, 95);
-   stbi_write_hdr("wr6x5_regular.hdr", 6, 5, 3, img6x5_rgbf);
+   stbi_write_png("output/wr6x5_regular.png", 6, 5, 3, img6x5_rgb, 6*3);
+   stbi_write_bmp("output/wr6x5_regular.bmp", 6, 5, 3, img6x5_rgb);
+   stbi_write_tga("output/wr6x5_regular.tga", 6, 5, 3, img6x5_rgb);
+   stbi_write_jpg("output/wr6x5_regular.jpg", 6, 5, 3, img6x5_rgb, 95);
+   stbi_write_hdr("output/wr6x5_regular.hdr", 6, 5, 3, img6x5_rgbf);
 
    stbi_flip_vertically_on_write(1);
 
-   stbi_write_png("wr6x5_flip.png", 6, 5, 3, img6x5_rgb, 6*3);
-   stbi_write_bmp("wr6x5_flip.bmp", 6, 5, 3, img6x5_rgb);
-   stbi_write_tga("wr6x5_flip.tga", 6, 5, 3, img6x5_rgb);
-   stbi_write_jpg("wr6x5_flip.jpg", 6, 5, 3, img6x5_rgb, 95);
-   stbi_write_hdr("wr6x5_flip.hdr", 6, 5, 3, img6x5_rgbf);
+   stbi_write_png("output/wr6x5_flip.png", 6, 5, 3, img6x5_rgb, 6*3);
+   stbi_write_bmp("output/wr6x5_flip.bmp", 6, 5, 3, img6x5_rgb);
+   stbi_write_tga("output/wr6x5_flip.tga", 6, 5, 3, img6x5_rgb);
+   stbi_write_jpg("output/wr6x5_flip.jpg", 6, 5, 3, img6x5_rgb, 95);
+   stbi_write_hdr("output/wr6x5_flip.hdr", 6, 5, 3, img6x5_rgbf);
+}
 
+#ifdef IWT_TEST
+int main(int argc, char **argv)
+{
+   image_write_test();
    return 0;
 }
+#endif

+ 13 - 1
tests/stb.dsp

@@ -66,7 +66,7 @@ LINK32=link.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "TT_TEST" /FR /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "DS_TEST" /FR /FD /GZ /c
 # SUBTRACT CPP /YX
 # ADD BASE RSC /l 0x409 /d "_DEBUG"
 # ADD RSC /l 0x409 /d "_DEBUG"
@@ -110,6 +110,10 @@ SOURCE=..\stb_divide.h
 # End Source File
 # Begin Source File
 
+SOURCE=..\stb_ds.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\stb_dxt.h
 # End Source File
 # Begin Source File
@@ -150,6 +154,10 @@ SOURCE=..\stb_pg.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\stb_query.h
+# End Source File
+# Begin Source File
+
 SOURCE=..\stb_rect_pack.h
 # End Source File
 # Begin Source File
@@ -198,6 +206,10 @@ SOURCE=.\test_c_lexer.c
 # End Source File
 # Begin Source File
 
+SOURCE=.\test_ds.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\test_dxt.c
 # End Source File
 # Begin Source File

+ 0 - 12
tests/stb.dsw

@@ -63,18 +63,6 @@ Package=<4>
 
 ###############################################################################
 
-Project: "pg_test"=.\pg_test\pg_test.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
 Project: "resize"=.\resize.dsp - Package Owner=<4>
 
 Package=<5>

+ 3 - 2
tests/test_c_compilation.c

@@ -11,6 +11,7 @@
 #define STB_RECT_PACK_IMPLEMENTATION
 #define STB_VOXEL_RENDER_IMPLEMENTATION
 #define STB_EASY_FONT_IMPLEMENTATION
+#define STB_DXT_IMPLEMENTATION
 
 #include "stb_herringbone_wang_tile.h"
 #include "stb_image.h"
@@ -20,10 +21,10 @@
 #include "stb_divide.h"
 #include "stb_image_resize.h"
 #include "stb_rect_pack.h"
-
-#define STB_DXT_IMPLEMENTATION
 #include "stb_dxt.h"
 
+#include "stb_ds.h"
+
 #define STBVOX_CONFIG_MODE 1
 #include "stb_voxel_render.h"
 

+ 2 - 0
tests/test_cpp_compilation.cpp

@@ -15,6 +15,7 @@
 #define STB_RECT_PACK_IMPLEMENTATION
 #define STB_VOXEL_RENDER_IMPLEMENTATION
 #define STB_CONNECTED_COMPONENTS_IMPLEMENTATION
+#define STB_DS_IMPLEMENTATION
 
 #define STBI_MALLOC     my_malloc
 #define STBI_FREE       my_free
@@ -33,6 +34,7 @@ void my_free(void *) { }
 #include "stb_c_lexer.h"
 #include "stb_divide.h"
 #include "stb_herringbone_wang_tile.h"
+#include "stb_ds.h"
 
 #define STBCC_GRID_COUNT_X_LOG2  10
 #define STBCC_GRID_COUNT_Y_LOG2  10