mirror of
https://github.com/devZoGok/gameBase.git
synced 2026-08-26 19:43:28 +00:00
Lua field test begining
This commit is contained in:
+23
-7
@@ -1,13 +1,15 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(gameBase)
|
||||
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
cmake_policy(SET CMP0015 NEW)
|
||||
set(CMAKE_BUILD_TYPE Debug)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(BUILD_TESTS ON)
|
||||
|
||||
set(states abstractAppState.cpp)
|
||||
set(core inputManager.cpp mapping.h stateManager.cpp luaManager.cpp)
|
||||
set(util util.cpp)
|
||||
set(STATES abstractAppState.cpp)
|
||||
set(CORE inputManager.cpp mapping.h stateManager.cpp luaManager.cpp luaFields.cpp)
|
||||
set(UTIL util.cpp)
|
||||
set(LIB_SRC ${STATES} ${CORE} ${UTIL})
|
||||
|
||||
set(GLFW_DIR vb01/external/glfw)
|
||||
set(LUA_DIR external/lua)
|
||||
@@ -18,7 +20,7 @@ set(LUA_LIB_DIR ${LUA_DIR})
|
||||
include_directories(${LUA_DIR})
|
||||
link_directories(${LUA_DIR})
|
||||
|
||||
add_library(gameBase STATIC ${states} ${core} ${util})
|
||||
add_library(gameBase STATIC ${LIB_SRC})
|
||||
set(GLFW_DIR ../vb01/external/glfw)
|
||||
set(LIB_NAME gameBase)
|
||||
|
||||
@@ -26,6 +28,20 @@ set(GLFW_LIB_DIR ../vb01/build/external/glfw/src)
|
||||
target_include_directories(${LIB_NAME} PUBLIC ${GLFW_DIR}/include/GLFW)
|
||||
target_link_directories(${LIB_NAME} PUBLIC ${GLFW_LIB_DIR})
|
||||
|
||||
target_link_libraries(${LIB_NAME} lua)
|
||||
target_link_libraries(gameBase glfw)
|
||||
set(DEPS lua glfw)
|
||||
target_link_libraries(${LIB_NAME} ${DEPS})
|
||||
|
||||
if(BUILD_TESTS)
|
||||
if(UNIX)
|
||||
include_directories(/usr/include/cppunit)
|
||||
link_directories(/usr/lib)
|
||||
elseif(WIN32)
|
||||
include_directories(C:/Program\ Files\ \(x86\)/cppunit/include)
|
||||
link_directories(C:/Program\ Files\ \(x86\)/cppunit/lib)
|
||||
endif()
|
||||
|
||||
set(TEST_SRC main.cpp ${LIB_SRC} luaFieldsTest.cpp)
|
||||
|
||||
add_executable(gameBaseTests ${TEST_SRC})
|
||||
target_link_libraries(gameBaseTests ${LIB_NAME} ${DEPS} cppunit)
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include "luaFields.h"
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
#ifndef LUA_FIELDS_H
|
||||
#define LUA_FIELDS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace gameBase{
|
||||
class AbstractLuaField{
|
||||
public:
|
||||
std::string name = "";
|
||||
protected:
|
||||
AbstractLuaField();
|
||||
std::string toString();
|
||||
};
|
||||
|
||||
class LuaTableField : public AbstractLuaField{
|
||||
public:
|
||||
LuaTableField();
|
||||
std::string toString();
|
||||
AbstractLuaField operator[](std::string);
|
||||
private:
|
||||
std::vector<AbstractLuaField> fields;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "luaFieldsTest.h"
|
||||
|
||||
namespace gameBase{
|
||||
void LuaFieldsTest::setUp(){
|
||||
}
|
||||
|
||||
void LuaFieldsTest::tearDown(){
|
||||
}
|
||||
|
||||
void LuaFieldsTest::testTableToString(){
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef LUA_FIELDS_TEST_H
|
||||
#define LUA_FIELDS_TEST_H
|
||||
|
||||
#include <cppunit/TestFixture.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
namespace gameBase{
|
||||
class LuaFieldsTest : public CppUnit::TestFixture{
|
||||
CPPUNIT_TEST_SUITE(LuaFieldsTest);
|
||||
CPPUNIT_TEST(testTableToString);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
LuaFieldsTest(){}
|
||||
void setUp();
|
||||
void tearDown();
|
||||
private:
|
||||
void testTableToString();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
#include <cppunit/TestSuite.h>
|
||||
#include <cppunit/TestResult.h>
|
||||
#include <cppunit/TestCaller.h>
|
||||
#include <cppunit/ui/text/TestRunner.h>
|
||||
|
||||
#include "luaFieldsTest.h"
|
||||
|
||||
using namespace CppUnit;
|
||||
using namespace gameBase;
|
||||
|
||||
int main(){
|
||||
TextUi::TestRunner runner;
|
||||
runner.addTest(LuaFieldsTest::suite());
|
||||
runner.run();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user