From d0dbf70e48af046ca2390e661cfdda4e28516edc Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 18 Jul 2016 21:35:09 -0400 Subject: [PATCH] set up the basic testing scheme. --- README.txt | 2 +- build_all.bat | 2 +- internal_4coder_tests.cpp | 39 +++++++++++++++++++++++++++++++++++- power/4coder_experiments.cpp | 6 ++++++ 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/README.txt b/README.txt index f06c8f4e..5f2495f9 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -Distribution Date: 17.7.2016 (dd.mm.yyyy) +Distribution Date: 18.7.2016 (dd.mm.yyyy) Thank you for contributing to the 4coder project! diff --git a/build_all.bat b/build_all.bat index f0cc8bbb..218c3427 100644 --- a/build_all.bat +++ b/build_all.bat @@ -26,7 +26,7 @@ popd pushd ..\build REM call "%CODE_DIR%\buildsuper.bat" ..\code\4coder_default_bindings.cpp -call "%CODE_DIR%\buildsuper.bat" ..\code\power\4coder_experiments.cpp +call "%CODE_DIR%\buildsuper.bat" ..\code\internal_4coder_tests.cpp REM call "%CODE_DIR%\buildsuper.bat" ..\code\power\4coder_casey.cpp REM call "%CODE_DIR%\buildsuper.bat" ..\4vim\4coder_chronal.cpp if %ERRORLEVEL% neq 0 (set FirstError=1) diff --git a/internal_4coder_tests.cpp b/internal_4coder_tests.cpp index 88b5ba73..d4207f7f 100644 --- a/internal_4coder_tests.cpp +++ b/internal_4coder_tests.cpp @@ -11,8 +11,45 @@ Allen Webster // TOP -#include "test_this.cpp" +#define LOTS_OF_FILES "w:/4ed/data/lots_of_files" +#define TEST_TIME_B() +#define TEST_TIME_E() + + + +#include "4coder_default_include.cpp" +#include "4coder_default_building.cpp" + +CUSTOM_COMMAND_SIG(load_lots_of_files){ + TEST_TIME_B(); + + File_List list = app->get_file_list(app, literal(LOTS_OF_FILES)); + File_Info *info = list.infos; + + for (int i = 0; i < list.count; ++i, ++info){ + if (!info->folder){ + app->create_buffer(app, info->filename, info->filename_len, BufferCreate_Background); + } + } + + app->free_file_list(app, list); + + TEST_TIME_E(); +} + +static void +test_get_bindings(Bind_Helper *context){ + begin_map(context, mapid_global); + + bind(context, key_f3, MDFR_NONE, load_lots_of_files); + + end_map(context); +} + +#define BIND_4CODER_TESTS(context) test_get_bindings(context) + +#include "power/4coder_experiments.cpp" // BOTTOM diff --git a/power/4coder_experiments.cpp b/power/4coder_experiments.cpp index f6d92b76..4259cac4 100644 --- a/power/4coder_experiments.cpp +++ b/power/4coder_experiments.cpp @@ -7,6 +7,10 @@ #define NO_BINDING #include "4coder_default_bindings.cpp" +#ifndef BIND_4CODER_TESTS +# define BIND_4CODER_TESTS(context) ((void)context) +#endif + #include CUSTOM_COMMAND_SIG(kill_rect){ @@ -404,6 +408,8 @@ get_bindings(void *data, int size){ bind(context, '\'', MDFR_ALT, cursor_to_surrounding_scope); end_map(context); + BIND_4CODER_TESTS(context); + int result = end_bind_helper(context); return(result); }