From 45603df3312afab7d88baf0fc19340a49362e4d8 Mon Sep 17 00:00:00 2001 From: keithsterling Date: Thu, 18 May 2017 09:00:03 +0100 Subject: [PATCH] Initial commit of adding grammar tests to y-bot, more to follow --- .../aiml/core/{ => services}/pandora.aiml | 0 .../aiml/core/{ => services}/pannous.aiml | 0 .../aiml/core/{ => services}/wikipedia.aiml | 0 .../tests/core/aimlstandardlibrary.tests | 86 +++++++++++++++++++ bots/y-bot/tests/core/bot_profile.tests | 4 + bots/y-bot/tests/core/config.tests | 2 + bots/y-bot/tests/core/pand_system.tests | 6 ++ bots/y-bot/y-bot_tests.sh | 8 ++ 8 files changed, 106 insertions(+) rename bots/y-bot/aiml/core/{ => services}/pandora.aiml (100%) rename bots/y-bot/aiml/core/{ => services}/pannous.aiml (100%) rename bots/y-bot/aiml/core/{ => services}/wikipedia.aiml (100%) create mode 100644 bots/y-bot/tests/core/aimlstandardlibrary.tests create mode 100644 bots/y-bot/tests/core/bot_profile.tests create mode 100644 bots/y-bot/tests/core/config.tests create mode 100644 bots/y-bot/tests/core/pand_system.tests create mode 100755 bots/y-bot/y-bot_tests.sh diff --git a/bots/y-bot/aiml/core/pandora.aiml b/bots/y-bot/aiml/core/services/pandora.aiml similarity index 100% rename from bots/y-bot/aiml/core/pandora.aiml rename to bots/y-bot/aiml/core/services/pandora.aiml diff --git a/bots/y-bot/aiml/core/pannous.aiml b/bots/y-bot/aiml/core/services/pannous.aiml similarity index 100% rename from bots/y-bot/aiml/core/pannous.aiml rename to bots/y-bot/aiml/core/services/pannous.aiml diff --git a/bots/y-bot/aiml/core/wikipedia.aiml b/bots/y-bot/aiml/core/services/wikipedia.aiml similarity index 100% rename from bots/y-bot/aiml/core/wikipedia.aiml rename to bots/y-bot/aiml/core/services/wikipedia.aiml diff --git a/bots/y-bot/tests/core/aimlstandardlibrary.tests b/bots/y-bot/tests/core/aimlstandardlibrary.tests new file mode 100644 index 000000000..6171b6881 --- /dev/null +++ b/bots/y-bot/tests/core/aimlstandardlibrary.tests @@ -0,0 +1,86 @@ +"XFALSE X", "FALSE" +"XTRUE X", "TRUE" +"XNUMBER 1", "1" +"XNUMBER X", "Sorry, I don't have an answer for that!!" +"XSTRING X", "X" +"XSTRING X@Y", "X AT Y" +"XISTRUE TRUE", "TRUE" +"XISTRUE FALSE", "FALSE" +"XISTRUE 6", "FALSE" +"XISFALSE FALSE", "TRUE" +"XISFALSE TRUE", "FALSE" +"XISFALSE 7", "FALSE" +"XISNUMBER 1", "TRUE" +"XISNUMBER X", "FALSE" +"XTYPEOF 1", "XNUMBER" +"XTYPEOF X", "XSTRING" +"XTYPEOF TRUE", "XBOOL" + +"XADD 1 XS 2", "3" +"XADD 1 XS 0", "1" + +"XSUB 10 XS 3", "7" +"XSUB 0 XS 1", "0" +"XSUB 2 XS 0", "2" + +"XMUL 2 XS 2", "4" +"XMUL 2 XS 0", "0" + +"XDIV 8 XS 4", "2" +"XDIV 0 XS 0", "undefined" +"XDIV 11 XS 0", "infinite" + +"XMOD 11 XS 3", "2" +"XMOD 0 XS 0", "undefined" +"XMOD 11 XS 0", "infinite" + +"XLT 1 XS 2", "TRUE" +"XLT 2 XS 1", "FALSE" + +"XGT 3 XS 1", "TRUE" +"XGT 1 XS 3", "FALSE" + +"XLE 1 XS 2", "TRUE" +"XLE 2 XS 1", "FALSE" +"XLE 2 XS 2", "TRUE" + +"XGE 3 XS 1", "TRUE" +"XGE 3 XS 1", "TRUE" +"XGE 3 XS 3", "TRUE" + +"XEQ 1 XS 0", "FALSE" +"XEQ 0 XS 1", "FALSE" +"XEQ 0 XS 0", "TRUE" + +"XNE 1 XS 2", "TRUE" +"XNE 2 XS 1", "TRUE" +"XNE 1 XS 1", "FALSE" + +"XNOT TRUE", "FALSE" +"XNOT FALSE", "TRUE" + +"XXLENGTH X XS 0", "1" +"XXLENGTH X Y XS 0", "1" + +"XLENGTH", "0" +"XLENGTH HELLO", "5" +"XLENGTH HELLO THERE", "10" + +"XRANDOM", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" +"XSUBSTRING ROSEMARY XS 4", "MARY" + +"XMAX 7", "7" +"XMAX 1 2 3", "3" + +"XMIN 1 2 3", "1" + +"XCAR 1 2 3", "1" +"XCDR 1 2 3", "2 3" +"XIMPLODE 1 2 3", "123" +"XREVERSE 1 2 3", "3 2 1" +"XBLACKHOLE", "" + +"XLOOP KEIFF XS 1", "KEIFF" +"XLOOP KEIFF XS 3", "KEIFF KEIFF KEIFF" + +"XCOUNT 1 2 3", "3" diff --git a/bots/y-bot/tests/core/bot_profile.tests b/bots/y-bot/tests/core/bot_profile.tests new file mode 100644 index 000000000..c85914f88 --- /dev/null +++ b/bots/y-bot/tests/core/bot_profile.tests @@ -0,0 +1,4 @@ +"FIRST NAME", "My first name is Y." +"MIDDLE NAME", "My middle name is AIML." +"LAST NAME", "My last name is BoT." +"FULL NAME", "My full name is Y-Bot." diff --git a/bots/y-bot/tests/core/config.tests b/bots/y-bot/tests/core/config.tests new file mode 100644 index 000000000..ac5bbaf2a --- /dev/null +++ b/bots/y-bot/tests/core/config.tests @@ -0,0 +1,2 @@ +"XSET ENV TEST", "Environment is TEST" +"XSET DEVICE TEST", "Device is TEST" \ No newline at end of file diff --git a/bots/y-bot/tests/core/pand_system.tests b/bots/y-bot/tests/core/pand_system.tests new file mode 100644 index 000000000..a9d878b91 --- /dev/null +++ b/bots/y-bot/tests/core/pand_system.tests @@ -0,0 +1,6 @@ +"RUBBISH", "Sorry, I don't have an answer for that!" +"BRAIN VERSION", "Y-Bot 0.0.1" +"PROGRAM VERSION", "Y-Bot 0.0.1" +"BRAIN BUILD", "Y-Bot 0.0.1" +"AIML MATCH LIMIT XXX", "Match limit exceeded" +"AIML MATCH FAIL XXX", "Match failed" diff --git a/bots/y-bot/y-bot_tests.sh b/bots/y-bot/y-bot_tests.sh new file mode 100755 index 000000000..b42c8d40f --- /dev/null +++ b/bots/y-bot/y-bot_tests.sh @@ -0,0 +1,8 @@ +#! /bin/sh + +clear + +export PYTHONPATH=../../src:../../libs/MetOffer-1.3.2:. + +python3 ../../src/programy/clients/test_runner.py --test_dir ./tests --config ./config.yaml --cformat yaml --logging ./logging.yaml --debug +