#include <map> #include <string> #include <vector> #include "ctx.h" #include "llm.h" #include "memory_Context.h" #include "main.h" std::string cli_test_exit_e( ) { auto c = memory_createContext(); c.input = "e"; c.recentField = "input"; c = cli_exit(c); if ( c.recentField == "exit" ) { return "OK: cli_exit_e"; } return "ERR: cli_exit_e"; } std::string cli_test_exit_exit( ) { auto c = memory_createContext(); c.input = "exit"; c.recentField = "input"; c = cli_exit(c); if ( c.recentField == "exit" ) { return "OK: cli_exit_exit"; } return "ERR: cli_exit_e"; } std::string cli_test_exit_victory( ) { auto c = memory_createContext(); c.playfieldSize = 2; c.recentField = "playfieldSize"; c = memory_generateConstPlayfield(c); // Match the first pair of tiles. c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "2"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_hideMatchingItems(c); // Match the second pair of tiles. c.input = "3"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "4"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_hideMatchingItems(c); c = memory_detectVictory(c); c = cli_reportVictory(c); c = cli_exit(c); if ( c.recentField == "exit" ) { return "OK: cli_exit_victory"; } return "ERR: cli_exit_victory"; } std::string cli_test_exit_q( ) { auto c = memory_createContext(); c.input = "q"; c.recentField = "input"; c = cli_exit(c); if ( c.recentField == "exit" ) { return "OK: cli_exit_q"; } return "ERR: cli_exit_q"; } std::string cli_test_exit_quit( ) { auto c = memory_createContext(); c.input = "quit"; c.recentField = "input"; c = cli_exit(c); if ( c.recentField == "exit" ) { return "OK: cli_exit_quit"; } return "ERR: cli_exit_quit"; } std::string cli_test_goOn( ) { auto c = memory_createContext(); c.playfieldSize = 2; c.recentField = "playfieldSize"; c = memory_generateConstPlayfield(c); // Match the first pair of items. c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "2"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_hideMatchingItems(c); c = cli_reportMatchedItems(c); c = cli_goOn(c); if ( c.recentField == "outputGoOn" ) { return "OK: cli_goOn"; } return "ERR: cli_goOn"; } std::string cli_test_greetUser( ) { auto c = memory_createContext(); c.didLaunch = true; c.recentField = "didLaunch"; c = cli_greetUser(c); if ( c.recentField == "outputGreeting" ) { return "OK: cli_greetUser"; } return "ERR: cli_greetUser"; } std::string cli_test_promptSecondItemSelection( ) { auto c = memory_createContext(); c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = cli_promptSecondItemSelection(c); if ( c.recentField == "outputPromptSelection" ) { return "OK: cli_promptSecondItemSelection"; } return "ERR: cli_promptSecondItemSelection"; } std::string cli_test_reportMatchedItems( ) { auto c = memory_createContext(); c.playfieldSize = 2; c.recentField = "playfieldSize"; c = memory_generateConstPlayfield(c); c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "2"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_hideMatchingItems(c); c = cli_reportMatchedItems(c); if ( c.recentField == "outputMatchedItems" ) { return "OK: cli_reportMatchedItems"; } return "ERR: cli_reportMatchedItems"; } std::string cli_test_reportMismatchedItems( ) { auto c = memory_createContext(); c.playfieldSize = 2; c.recentField = "playfieldSize"; c = memory_generateConstPlayfield(c); c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "3"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_detectMismatchedItems(c); c = cli_reportMismatchedItems(c); if ( c.recentField == "outputMismatchedItems" ) { return "OK: cli_reportMismatchedItems"; } return "ERR: cli_reportMismatchedItems"; } std::string cli_test_selectItem( ) { auto c = memory_createContext(); c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); if ( c.recentField == "selectedId" && c.selectedId == 0 ) { return "OK: cli_selectItem"; } return "ERR: cli_selectItem"; } std::string cli_test_showHelp_h( ) { auto c = memory_createContext(); c.input = "h"; c.recentField = "input"; c = cli_showHelp(c); if ( c.recentField == "outputHelp" ) { return "OK: cli_showHelp_h"; } return "ERR: cli_showHelp_h"; } std::string cli_test_showHelp_help( ) { auto c = memory_createContext(); c.input = "help"; c.recentField = "input"; c = cli_showHelp(c); if ( c.recentField == "outputHelp" ) { return "OK: cli_showHelp_help"; } return "ERR: cli_showHelp_help"; } std::string cli_test_reportVictory( ) { auto c = memory_createContext(); c.playfieldSize = 2; c.recentField = "playfieldSize"; c = memory_generateConstPlayfield(c); // Match the first pair of tiles. c.input = "1"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "2"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_hideMatchingItems(c); // Match the second pair of tiles. c.input = "3"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c.input = "4"; c.recentField = "input"; c = cli_selectItem(c); c = memory_selectItem(c); c = memory_hideMatchingItems(c); c = memory_detectVictory(c); c = cli_reportVictory(c); if ( c.recentField == "outputVictory" ) { return "OK: cli_reportVictory"; } return "ERR: cli_reportVictory"; } //def cli_test_shouldReportIvalidItemSelection_outOfBoundsMin( //) -> str: // c = cli_createContext() // c.cMemory = memory_createContext() // c.input = "0" // c = cli_selectItem(c) // c = cli_shouldReportInvalidItemSelection(c) // if ( // c.recentField == "outputInvalidItemSelection" // ): // return "OK: cli_shouldReportInvalidItemSelection" // //} // return "ERR: cli_shouldReportInvalidItemSelection" ////} //