-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
tests are always included in build, but runs on demand only cmake --build <build_dir> --target ReDefine.Test - added mingw support, for internal use uses c++17 due to missing std::experimental::filesystem
- Loading branch information
Showing
20 changed files
with
173 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* text=auto eol=lf | ||
|
||
*.bat text eol=crlf | ||
*.cmd text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
cmake_minimum_required( VERSION 3.14 FATAL_ERROR ) | ||
|
||
file( GLOB_RECURSE found_tests LIST_DIRECTORIES false RELATIVE "${CMAKE_CURRENT_LIST_DIR}" CONFIGURE_DEPENDS "*.test" ) | ||
|
||
enable_testing() | ||
foreach( file IN LISTS found_tests ) | ||
get_filename_component( name_dir "${file}" DIRECTORY ) | ||
get_filename_component( name_wle "${file}" NAME_WLE ) | ||
set( name "${name_dir}/${name_wle}" ) | ||
# string( REGEX REPLACE "/ReDefine\\.test$" "" name "${file}" ) | ||
message( STATUS "Add test... ${name}" ) | ||
add_test( NAME ${name} | ||
COMMAND ${CMAKE_COMMAND} -DREDEFINE=$<TARGET_FILE:ReDefine> -DTEST_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${file} -P ${CMAKE_CURRENT_SOURCE_DIR}/Run.cmake | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
endforeach() | ||
|
||
add_custom_target( ReDefine.Test | ||
DEPENDS ReDefine ${found_tests} | ||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[ReDefine] | ||
HeadersDir = . | ||
ScriptsDir = . | ||
|
||
[Defines] | ||
DUMMY = ReDefine.cfg DUMMY | ||
|
||
[Defines:ITEM_PID] | ||
252 = PID_ANNA_GOLD_LOCKET | ||
|
||
[Function] | ||
obj_is_carrying_obj_pid = ? ITEM_PID | ||
|
||
[Script:Minimize:ObjCarrying] | ||
GetItem = RunAfter:90 IfFunction:obj_carrying_pid_obj DoNameSet:get_item | ||
GetItemCount = RunAfter:90 IfFunction:obj_is_carrying_obj_pid DoNameSet:get_item_count | ||
# | ||
SelfItem = RunAfter:90 IfFunction:get_item IfArgumentValue:0,self_obj DoNameSet:self_item DoArgumentsErase:0 | ||
SelfItemCount = RunAfter:90 IfFunction:get_item_count IfArgumentValue:0,self_obj DoNameSet:self_item_count DoArgumentsErase:0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- | ||
debug_msg("dcanna" + ": " + " obj_is_carrying_obj_pid(self_obj, PID_ANNA_GOLD_LOCKET) == " + obj_is_carrying_obj_pid(self_obj, 252) + "\n"); | ||
debug_msg("dcanna" + ": " + " obj_is_carrying_obj_pid(self_obj, PID_ANNA_GOLD_LOCKET) == " + self_item_count( PID_ANNA_GOLD_LOCKET ) + "\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
set( PWD "${CMAKE_CURRENT_BINARY_DIR}" ) | ||
|
||
if( NOT REDEFINE ) | ||
message( FATAL_ERROR "REDEFINE not set" ) | ||
elseif( NOT TEST_FILE ) | ||
message( FATAL_ERROR "TEST_FILE not set" ) | ||
endif() | ||
|
||
get_filename_component( TEST_DIR "${TEST_FILE}" DIRECTORY ) | ||
set( REDEFINE_CFG "${TEST_DIR}/ReDefine.cfg" ) | ||
|
||
#message( STATUS "TEST_DIR = ${TEST_DIR}" ) | ||
#message( STATUS "TEST_FILE = ${TEST_FILE}" ) | ||
|
||
file( STRINGS "${TEST_FILE}" lines ) | ||
#foreach( line IN LISTS lines ) | ||
# message( STATUS "${line}" ) | ||
#endforeach() | ||
|
||
list( GET lines 0 script ) | ||
list( GET lines 1 origin ) | ||
list( GET lines 2 expect ) | ||
|
||
#message( STATUS "SCRIPT=${script} ORIGIN=${origin} EXPECT=${expect}" ) | ||
|
||
file( REMOVE_RECURSE "Run" ) | ||
file( MAKE_DIRECTORY "Run" ) | ||
|
||
if( EXISTS "${REDEFINE_CFG}" ) | ||
file( COPY "${REDEFINE_CFG}" DESTINATION "Run" ) | ||
endif() | ||
|
||
if( NOT "${script}" STREQUAL "-" ) | ||
file( APPEND "Run/ReDefine.cfg" "\n" ) | ||
file( APPEND "Run/ReDefine.cfg" "[Script:Test]\n" ) | ||
file( APPEND "Run/ReDefine.cfg" "Run = ${script}\n" ) | ||
endif() | ||
|
||
file( WRITE "Run/ReDefine.ssl" "${origin}" ) | ||
|
||
execute_process( | ||
COMMAND ${REDEFINE} --debug-changes 1 | ||
WORKING_DIRECTORY ${PWD}/Run | ||
) | ||
|
||
file( STRINGS "Run/ReDefine.ssl" lines ) | ||
list( GET lines 0 result ) | ||
|
||
if( NOT "${expect}" STREQUAL "${result}" ) | ||
message( "" ) | ||
message( STATUS "EXPECT ${expect}" ) | ||
message( STATUS "RESULT ${result}" ) | ||
message( "" ) | ||
message( FATAL_ERROR "TEST FAILED" ) | ||
endif() | ||
file( REMOVE_RECURSE "Run" ) |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsErase/2Arguments.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsErase:0 | ||
f(a, b); | ||
f(b); |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsErase/3Arguments.0.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsErase:0 | ||
f(a, b, c); | ||
f(b, c); |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsErase/3Arguments.1.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsErase:1 | ||
f(a, b, c); | ||
f(a, c); |
8 changes: 8 additions & 0 deletions
8
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsErase/ReDefine.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ReDefine] | ||
HeadersDir = . | ||
ScriptsDir = . | ||
|
||
FormatFunctions = 0 | ||
|
||
[Defines] | ||
DUMMY = ReDefine.cfg DUMMY |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveBack/3Arguments.0.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsMoveBack:0 | ||
f(a, b, c); | ||
f(b, c, a); |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveBack/3Arguments.1.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsMoveBack:1 | ||
f(a, b, c); | ||
f(a, c, b); |
8 changes: 8 additions & 0 deletions
8
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveBack/ReDefine.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ReDefine] | ||
HeadersDir = . | ||
ScriptsDir = . | ||
|
||
FormatFunctions = 0 | ||
|
||
[Defines] | ||
DUMMY = ReDefine.cfg DUMMY |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveFront/2Arguments.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsMoveFront:1 | ||
f(a, b); | ||
f(b, a); |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveFront/3Arguments.1.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsMoveFront:1 | ||
f(a, b, c); | ||
f(b, a, c); |
3 changes: 3 additions & 0 deletions
3
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveFront/3Arguments.2.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
RunAfter IfFunction DoArgumentsMoveFront:2 | ||
f(a, b, c); | ||
f(c, a, b); |
8 changes: 8 additions & 0 deletions
8
Source/Test/SCRIPT_FORMAT_UNCHANGED/DoArgumentsMoveFront/ReDefine.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[ReDefine] | ||
HeadersDir = . | ||
ScriptsDir = . | ||
|
||
FormatFunctions = 0 | ||
|
||
[Defines] | ||
DUMMY = ReDefine.cfg DUMMY |