[Supertux-Commit] r6000 - in branches/supertux-milestone2-grumbel: . test

grumbel at cummiskey.dreamhost.com grumbel at cummiskey.dreamhost.com
Mon Nov 16 10:21:17 PST 2009


Author: grumbel
Date: 2009-11-16 10:21:17 -0800 (Mon, 16 Nov 2009)
New Revision: 6000

Added:
   branches/supertux-milestone2-grumbel/test/
   branches/supertux-milestone2-grumbel/test/md5_test.cpp
Modified:
   branches/supertux-milestone2-grumbel/SConscript
Log:
Added a test/ directory for test cases

Modified: branches/supertux-milestone2-grumbel/SConscript
===================================================================
--- branches/supertux-milestone2-grumbel/SConscript	2009-11-16 18:06:20 UTC (rev 5999)
+++ branches/supertux-milestone2-grumbel/SConscript	2009-11-16 18:21:17 UTC (rev 6000)
@@ -20,6 +20,7 @@
         self.build_tinygettext()
         self.build_binreloc()
         self.build_supertux()
+        self.build_tests()
 
     def build_tinygettext(self):
         env = Environment(CPPPATH=["external/tinygettext/",
@@ -41,33 +42,33 @@
                                              Glob("external/squirrel/sqstdlib/*.c"))
 
     def build_supertux(self):
-        env = Environment(CPPPATH=["external/squirrel/include/",
-                                   "external/",
-                                   "external/obstack",
-                                   "src/",
-                                   "."],
-                          CXXFLAGS=["-O2", "-g3",
-                                    "-ansi",
-                                    "-pedantic",
-                                    "-Wall",
-                                    "-Wextra",
-                                    "-Wnon-virtual-dtor",
-                                    # "-Weffc++",
-                                    # "-Wconversion",
-                                    "-Werror",
-                                    # "-Wshadow",
-                                    "-Wcast-qual",
-                                    "-Winit-self", # only works with >= -O1
-                                    "-Wno-unused-parameter"],
-                          LIBS=["GL", "physfs"])
+        self.env = Environment(CPPPATH=["external/squirrel/include/",
+                                        "external/",
+                                        "external/obstack",
+                                        "src/",
+                                        "."],
+                               CXXFLAGS=["-O2", "-g3",
+                                         "-ansi",
+                                         "-pedantic",
+                                         "-Wall",
+                                         "-Wextra",
+                                         "-Wnon-virtual-dtor",
+                                         # "-Weffc++",
+                                         # "-Wconversion",
+                                         "-Werror",
+                                         # "-Wshadow",
+                                         "-Wcast-qual",
+                                         "-Winit-self", # only works with >= -O1
+                                         "-Wno-unused-parameter"],
+                               LIBS=["GL", "physfs"])
 
         # Add libraries
-        env.ParseConfig("sdl-config --libs --cflags")
-        env.ParseConfig("pkg-config --libs --cflags openal")
-        env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg")
-        env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext])
-        env.Append(LIBS=["SDL_image"])
-        env.Append(LIBS=["curl"])
+        self.env.ParseConfig("sdl-config --libs --cflags")
+        self.env.ParseConfig("pkg-config --libs --cflags openal")
+        self.env.ParseConfig("pkg-config --libs --cflags vorbis vorbisfile ogg")
+        self.env.Append(LIBS=[self.libsquirrel, self.libbinreloc, self.libtinygettext])
+        self.env.Append(LIBS=["SDL_image"])
+        self.env.Append(LIBS=["curl"])
 
         # Create config.h
         self.iconv_const = 0
@@ -87,10 +88,14 @@
         # optional video drivers
         supertux_sources += Glob("src/video/gl/*.cpp")
         supertux_sources += Glob("src/video/sdl/*.cpp")
-        
-        self.libsupertux = env.StaticLibrary("supertux", supertux_sources)
-        env.Program("supertux", ["src/main.cpp", self.libsupertux])
 
+        self.libsupertux = self.env.StaticLibrary("supertux", supertux_sources)
+        self.env.Program("supertux", ["src/main.cpp", self.libsupertux])
+
+    def build_tests(self):
+        for filename in Glob("test/*_test.cpp", strings=True):
+            self.env.Program(filename[:-4], [filename, self.libsupertux])
+
 project = Project()
 
 # EOF #

Added: branches/supertux-milestone2-grumbel/test/md5_test.cpp
===================================================================
--- branches/supertux-milestone2-grumbel/test/md5_test.cpp	                        (rev 0)
+++ branches/supertux-milestone2-grumbel/test/md5_test.cpp	2009-11-16 18:21:17 UTC (rev 6000)
@@ -0,0 +1,41 @@
+//  SuperTux
+//  Copyright (C) 2009 Ingo Ruhnke <grumbel at gmx.de>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#include <iostream>
+#include <errno.h>
+#include <string.h>
+
+#include "addon/md5.hpp"
+
+int main(int argc, char** argv)
+{
+  for(int i = 1; i < argc; ++i)
+  {
+    std::ifstream in(argv[i], std::ios::binary);
+    if (!in)
+    {
+      std::cerr << argv[0] << ": " << argv[i] << ": " << strerror(errno) << std::endl;
+    }
+    else
+    {
+      MD5 md5(in);
+      std::cout << md5.hex_digest() << "  " << argv[i] << std::endl;
+    }
+  }  
+  return 0;
+}
+
+/* EOF */


Property changes on: branches/supertux-milestone2-grumbel/test/md5_test.cpp
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Supertux-Commit mailing list