fix unit tests for reorganized codebase

This commit is contained in:
Josh Holtrop 2014-07-12 00:04:31 -04:00
parent e1c5d0f0f4
commit a717ed4a38
4 changed files with 15 additions and 14 deletions

View File

@ -12,35 +12,36 @@ base_env = Rscons::Environment.new do |env|
env["CCFLAGS"] += ["-Wall", "-O2"] env["CCFLAGS"] += ["-Wall", "-O2"]
env["CFLAGS"] << "-std=gnu99" env["CFLAGS"] << "-std=gnu99"
env["CXXFLAGS"] << "-std=gnu++11" env["CXXFLAGS"] << "-std=gnu++11"
env.parse_flags!("!sdl2-config --cflags --libs")
env.parse_flags!("!freetype-config --cflags --libs")
env["LIBS"] += ["dl"]
if RUBY_PLATFORM =~ /mingw/
env["LIBS"] += ["opengl32"]
else
env["LIBS"] += ["GL"]
end
end end
task :default do task :default do
base_env.clone(clone: :all) do |env| base_env.clone(clone: :all) do |env|
env.parse_flags!("!sdl2-config --cflags --libs")
env.parse_flags!("!freetype-config --cflags --libs")
env["LIBS"] += ["dl"]
if RUBY_PLATFORM =~ /mingw/
env["LIBS"] += ["opengl32"]
else
env["LIBS"] += ["GL"]
end
env.Program("bin/jes", Dir["src/**/*.{cc,c}"]) env.Program("bin/jes", Dir["src/**/*.{cc,c}"])
end end
end end
task :test => :default do task :test do
base_env.clone(clone: :all) do |env| base_env.clone(clone: :all) do |env|
env.build_root = "build/test"
env["CPPPATH"] << "src" env["CPPPATH"] << "src"
env["CPPPATH"] << "gtest-#{GTEST_VERSION}/include" env["CPPPATH"] << "gtest-#{GTEST_VERSION}/include"
env["CPPPATH"] << "gtest-#{GTEST_VERSION}" env["CPPPATH"] << "gtest-#{GTEST_VERSION}"
sources = Dir["gtest-#{GTEST_VERSION}/src/gtest-all.cc", sources = Dir["gtest-#{GTEST_VERSION}/src/gtest-all.cc",
"gtest-#{GTEST_VERSION}/src/gtest_main.cc", "gtest-#{GTEST_VERSION}/src/gtest_main.cc",
"src/**/*.{cc,c}", "src/**/*.{cc,c}",
"test/src/**/*.cc"] "test/src/**/*.cc"] - ["src/main.cc"]
env.Program("build/tests", sources)
if RUBY_PLATFORM =~ /linux/ if RUBY_PLATFORM =~ /linux/
env["LIBS"] << "pthread" env["LIBS"] << "pthread"
end end
env.Program("build/tests", sources)
end end
system("./build/tests") system("./build/tests")
end end

View File

@ -1,5 +1,5 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "jes/FileLoader.h" #include "FileLoader.h"
using namespace jes; using namespace jes;

View File

@ -1,5 +1,5 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "jes/Path.h" #include "Path.h"
#include <algorithm> #include <algorithm>
using namespace jes; using namespace jes;

View File

@ -1,5 +1,5 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "jes/Ref.h" #include "Ref.h"
#include <algorithm> #include <algorithm>
using namespace jes; using namespace jes;