From a717ed4a382daa9f3ba3c1bfc85945d760d824a1 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 12 Jul 2014 00:04:31 -0400 Subject: [PATCH] fix unit tests for reorganized codebase --- Rakefile.rb | 23 ++++++++++++----------- test/src/test_FileLoader.cc | 2 +- test/src/test_Path.cc | 2 +- test/src/test_Ref.cc | 2 +- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Rakefile.rb b/Rakefile.rb index ba44d73..c0058b7 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -12,35 +12,36 @@ base_env = Rscons::Environment.new do |env| env["CCFLAGS"] += ["-Wall", "-O2"] env["CFLAGS"] << "-std=gnu99" 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 task :default do 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}"]) end end -task :test => :default do +task :test do base_env.clone(clone: :all) do |env| + env.build_root = "build/test" env["CPPPATH"] << "src" env["CPPPATH"] << "gtest-#{GTEST_VERSION}/include" env["CPPPATH"] << "gtest-#{GTEST_VERSION}" sources = Dir["gtest-#{GTEST_VERSION}/src/gtest-all.cc", "gtest-#{GTEST_VERSION}/src/gtest_main.cc", "src/**/*.{cc,c}", - "test/src/**/*.cc"] - env.Program("build/tests", sources) + "test/src/**/*.cc"] - ["src/main.cc"] if RUBY_PLATFORM =~ /linux/ env["LIBS"] << "pthread" end + env.Program("build/tests", sources) end system("./build/tests") end diff --git a/test/src/test_FileLoader.cc b/test/src/test_FileLoader.cc index 0a102eb..49f4087 100644 --- a/test/src/test_FileLoader.cc +++ b/test/src/test_FileLoader.cc @@ -1,5 +1,5 @@ #include "gtest/gtest.h" -#include "jes/FileLoader.h" +#include "FileLoader.h" using namespace jes; diff --git a/test/src/test_Path.cc b/test/src/test_Path.cc index 9cff6ea..50cf1cd 100644 --- a/test/src/test_Path.cc +++ b/test/src/test_Path.cc @@ -1,5 +1,5 @@ #include "gtest/gtest.h" -#include "jes/Path.h" +#include "Path.h" #include using namespace jes; diff --git a/test/src/test_Ref.cc b/test/src/test_Ref.cc index 54a9a82..e1fcb59 100644 --- a/test/src/test_Ref.cc +++ b/test/src/test_Ref.cc @@ -1,5 +1,5 @@ #include "gtest/gtest.h" -#include "jes/Ref.h" +#include "Ref.h" #include using namespace jes;