diff --git a/src/tests/cli/config/_arg_parse_test.opennars.hjson b/src/tests/cli/config/_arg_parse_test.opennars.hjson new file mode 100644 index 0000000..b24ffc1 --- /dev/null +++ b/src/tests/cli/config/_arg_parse_test.opennars.hjson @@ -0,0 +1,23 @@ +#hjson +// * ⚠️仅作「读取配置」测试用 +// * 📌包含OpenNARS转译器 及其jar启动的命令配置 +// * 🎯用于测试「预加载NAL输入」,加载「简单演绎推理」 +{ + // 转译器 + translators: "opennars" + // 启动命令 + command: { + // 命令:启动java运行时 + cmd: "java" + // 传入的命令参数 + cmdArgs: [ + // 设置最大堆内存为1024M + "-Xmx1024m" + // 启动jar包 + -jar + nars.jar + ] + // 启动时的工作目录 | 仅测试「以配置自身为根」 + currentDir: ./../executables + } +} \ No newline at end of file diff --git a/src/tests/cli/config/cin_cxin_js.hjson b/src/tests/cli/config/cin_cxin_js.hjson new file mode 100644 index 0000000..3999356 --- /dev/null +++ b/src/tests/cli/config/cin_cxin_js.hjson @@ -0,0 +1,19 @@ +#hjson +// * 🎯用于测试CXinNARS(JS版本) +// * 📌使用Node.js启动 +{ + // 转译器支持单独指定「输入转译器」和「输出转译器」 + translators: cxin_js + command: { + // * ⚠️必须前缀`./`以指定是「启动当前工作目录下的exe文件」 + cmd: node + cmdArgs: [ + cxin-nars-shell.js + shell + ] + // * 🚩现在基于「固定位置的CIN程序包」运行测试 + // * 回溯路径:config(`./`) => cli => tests => src => BabelNAR.rs / executables + currentDir: ./../../../../executables + } + autoRestart: true +} \ No newline at end of file diff --git a/src/tests/cli/config/cin_native_il_1.hjson b/src/tests/cli/config/cin_native_il_1.hjson new file mode 100644 index 0000000..35597d4 --- /dev/null +++ b/src/tests/cli/config/cin_native_il_1.hjson @@ -0,0 +1,16 @@ +#hjson +// * 🎯用于测试原生「IL-1」运行时 +// * ✨基于NAVM,纯Rust编写 +{ + // 使用「原生」输入输出转译器 + translators: native + command: { + // * ⚠️必须前缀`./`以指定是「启动当前工作目录下的exe文件」 + cmd: ./native-IL-1.exe + cmdArgs: [] + // * 🚩现在基于「固定位置的CIN程序包」运行测试 + // * 回溯路径:config(`./`) => cli => tests => src => BabelNAR.rs / executables + currentDir: ./../../../../executables + } + autoRestart: true +} \ No newline at end of file diff --git a/src/tests/cli/config/cin_ona.hjson b/src/tests/cli/config/cin_ona.hjson new file mode 100644 index 0000000..d8ce203 --- /dev/null +++ b/src/tests/cli/config/cin_ona.hjson @@ -0,0 +1,22 @@ +#hjson +// * 🎯用于测试ONA +// * ⚠️启动需要cygwin +// * 🔗中文官网: http://www.cygwin.cn/ +{ + // 转译器支持单独指定「输入转译器」和「输出转译器」 + translators: { + in: ona + out: ona + } + command: { + // * ⚠️必须前缀`./`以指定是「启动当前工作目录下的exe文件」 + cmd: ./ONA.exe + cmdArgs: [ + shell + ] + // * 🚩现在基于「固定位置的CIN程序包」运行测试 + // * 回溯路径:config(`./`) => cli => tests => src => BabelNAR.rs / executables + currentDir: ./../../../../executables + } + autoRestart: true +} \ No newline at end of file diff --git a/src/tests/cli/config/cin_opennars.hjson b/src/tests/cli/config/cin_opennars.hjson new file mode 100644 index 0000000..bde0b8d --- /dev/null +++ b/src/tests/cli/config/cin_opennars.hjson @@ -0,0 +1,23 @@ +#hjson +// OpenNARS 3.0.4 的启动配置 +{ + // 转译器 + translators: "opennars" + // 启动命令 + command: { + // 命令:启动java运行时 + cmd: "java" + // 传入的命令参数 + cmdArgs: [ + // 设置最大堆内存为1024M + "-Xmx1024m" + // 启动jar包 + -jar + ./opennars-304-T-modified.jar + ] + // 启动时的工作目录 + // * 🚩现在基于「固定位置的CIN程序包」运行测试 + // * 回溯路径:config(`./`) => cli => tests => src => BabelNAR.rs / executables + currentDir: ./../../../../executables + } +} \ No newline at end of file diff --git a/src/tests/cli/config/cin_opennars_158.hjson b/src/tests/cli/config/cin_opennars_158.hjson new file mode 100644 index 0000000..abeb52e --- /dev/null +++ b/src/tests/cli/config/cin_opennars_158.hjson @@ -0,0 +1,23 @@ +#hjson +// OpenNARS 1.5.8 的启动配置 +{ + // 转译器 + translators: "opennars" + // 启动命令 + command: { + // 命令:启动java运行时 + cmd: "java" + // 传入的命令参数 + cmdArgs: [ + // 设置最大堆内存为1024M + "-Xmx1024m" + // 启动jar包 + -jar + ./opennars-158-shell.jar + ] + // 启动时的工作目录 + // * 🚩现在基于「固定位置的CIN程序包」运行测试 + // * 回溯路径:config(`./`) => cli => tests => src => BabelNAR.rs / executables + currentDir: ./../../../../executables + } +} \ No newline at end of file diff --git a/src/tests/cli/config/cin_pynars.hjson b/src/tests/cli/config/cin_pynars.hjson new file mode 100644 index 0000000..a11d001 --- /dev/null +++ b/src/tests/cli/config/cin_pynars.hjson @@ -0,0 +1,15 @@ +// PyNARS的启动配置 +{ + translators: pynars + command: { + cmd: python + cmdArgs: [ + "-m" + // * 🚩【2024-04-07 14:41:20】使用扩展了「附加指令」的「高级控制台」 + pynars.ConsolePlus + ] + // * 🚩【2024-04-07 14:26:30】现在「CIN测试用运行时」路径已固定 + currentDir: ./../../../../executables/PyNARS + } + autoRestart: true +} \ No newline at end of file diff --git a/src/tests/cli/config/matriangle_server.hjson b/src/tests/cli/config/matriangle_server.hjson new file mode 100644 index 0000000..bac6e35 --- /dev/null +++ b/src/tests/cli/config/matriangle_server.hjson @@ -0,0 +1,18 @@ +#hjson +// * 🎯对接Matriangle服务器 +// * ✨兼容旧BabelNAR与Matriangle的Websocket交互逻辑 +{ + // Websocket服务端地址 + websocket: { + // * ❌【2024-04-07 23:05:21】不能是`localhost`,需要是`127.0.0.1`(Matriangle端要求) + host: 127.0.0.1 + port: 8765 + } + // 【2024-04-04 04:49:32】Matriangle环境目前以「NAVM指令」的形式传入 + inputMode: cmd + preludeNAL: { + // 预置的NAL指令 + // * 🔬【2024-04-08 15:43:27】控制程序输出:当产生大量输出时,将会发生线程死锁 + text: "'''VOL 0" + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_higher_deduction.hjson b/src/tests/cli/config/nal_higher_deduction.hjson new file mode 100644 index 0000000..453b251 --- /dev/null +++ b/src/tests/cli/config/nal_higher_deduction.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「高阶演绎推理」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_higher_deduction.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_i_var_elimination.hjson b/src/tests/cli/config/nal_i_var_elimination.hjson new file mode 100644 index 0000000..3df33eb --- /dev/null +++ b/src/tests/cli/config/nal_i_var_elimination.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「自变量消去推理」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_i_var_elimination.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_operation.hjson b/src/tests/cli/config/nal_operation.hjson new file mode 100644 index 0000000..2144a80 --- /dev/null +++ b/src/tests/cli/config/nal_operation.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「操作推理」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_operation.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_simple_deduction.hjson b/src/tests/cli/config/nal_simple_deduction.hjson new file mode 100644 index 0000000..d533c72 --- /dev/null +++ b/src/tests/cli/config/nal_simple_deduction.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「简单演绎推理」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_simple_deduction.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_simple_operation.hjson b/src/tests/cli/config/nal_simple_operation.hjson new file mode 100644 index 0000000..8b3f9c7 --- /dev/null +++ b/src/tests/cli/config/nal_simple_operation.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「简单操作推理」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_simple_operation.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_temporal_induction.hjson b/src/tests/cli/config/nal_temporal_induction.hjson new file mode 100644 index 0000000..7b54610 --- /dev/null +++ b/src/tests/cli/config/nal_temporal_induction.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「时间归纳推理」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_temporal_induction.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/nal_truth_wildcard.hjson b/src/tests/cli/config/nal_truth_wildcard.hjson new file mode 100644 index 0000000..75186be --- /dev/null +++ b/src/tests/cli/config/nal_truth_wildcard.hjson @@ -0,0 +1,10 @@ +#hjson +// * 🎯测试「真值通配」 +// * ℹ️测试环境交由`prelude_test.hjson`加载 +// * 📌原则:每个配置文件中引用的相对路径,均基于「配置文件自身」的路径 +{ + preludeNAL: { + // 预置的NAL测试文件(相对配置文件自身) + file: ./../../nal/test_truth_wildcard.nal + } +} \ No newline at end of file diff --git a/src/tests/cli/config/prelude_test.hjson b/src/tests/cli/config/prelude_test.hjson new file mode 100644 index 0000000..f075a3c --- /dev/null +++ b/src/tests/cli/config/prelude_test.hjson @@ -0,0 +1,14 @@ +#hjson +// * 🎯测试「预加载NAL输入」,并统一设置「测试环境」 +// * ⚠️不包括具体的「预引入NAL」文件定义 +{ + // preludeNAL: "" + // 禁止用户输入 + userInput: false + // 不自动重启 + autoRestart: false + // 开启严格模式 + // * 🎯用于自动化测试中捕获错误 + // * ✨可由此被外部脚本调用 + strictMode: true +} \ No newline at end of file diff --git a/src/tests/cli/config/websocket.hjson b/src/tests/cli/config/websocket.hjson new file mode 100644 index 0000000..1b09197 --- /dev/null +++ b/src/tests/cli/config/websocket.hjson @@ -0,0 +1,8 @@ +#hjson +// 用于测试可作补丁的Websocket配置 +{ + websocket: { + host: localhost + port: 8080 + } +} \ No newline at end of file diff --git a/src/tests/nal/test_higher_deduction.nal b/src/tests/nal/test_higher_deduction.nal new file mode 100644 index 0000000..ad22c56 --- /dev/null +++ b/src/tests/nal/test_higher_deduction.nal @@ -0,0 +1,33 @@ +' 用于测试CIN的「高阶演绎推理」 +' * 📍所涉及NAL层级:NAL-5 +' * 📝在「文件表示」上利用现有`Narsese`语法 +' +' 输出等待 `expect-contains` +' * 📝统一的NAL等待语法:`''await: 【输入类别】 【其它内容】` +' * ⚠️可能会阻塞测试,慎用 +' * 🚩以下await已被注释失效,仅作语法演示 +' +' 输出预期 `expect-contains` +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER 【CommonNarsese】` +' * 📄预期「操作」:`''expect-contains: EXE (^【操作名】, 【操作参数(CommonNarsese词项)】)` + +' 🚩降低音量,减少无关输出 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + +< B> ==> D>>. +' // ''await: IN < B> ==> D>>. + B>. +' // ''await: IN B>. + D>? + +' 检验输出 +''expect-cycle(100, 10, 0.25s): ANSWER D>. +' * 🚩【2024-04-19 21:45:12】↑OpenNARS 3.x引入了大量心理操作,因此在「逐步递进」测试中性能不佳 +' * 📝【2024-04-19 21:46:42】OpenNARS 158、ONA、PyNARS等均能在五步之内回答 + +' 用户无法输入时退出(正常退出) +''terminate(if-no-user) diff --git a/src/tests/nal/test_i_var_elimination.nal b/src/tests/nal/test_i_var_elimination.nal new file mode 100644 index 0000000..defa381 --- /dev/null +++ b/src/tests/nal/test_i_var_elimination.nal @@ -0,0 +1,24 @@ +' 用于测试「自变量消除」 +' * 📍所涉及NAL层级:NAL-5、NAL-6 +' +' 输出预期 +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER 【CommonNarsese】` +' * 📄预期「操作」:`''expect-contains: EXE (^【操作名】, 【操作参数(CommonNarsese词项)】)` +' * 🚩【2024-04-03 02:10:19】有时对操作需要等待足够的时长,才能捕获到输出 + +' 🚩降低音量,减少无关输出 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + + B>. +< $1> ==> <$1 --> C>>. + C>? + +' 检验输出 | ⚠️0.25s需要兼容PyNARS +''expect-cycle(200, 20, 0.25s): ANSWER C>. + +' 用户无法输入时退出(正常退出) +''terminate(if-no-user) diff --git a/src/tests/nal/test_operation.nal b/src/tests/nal/test_operation.nal new file mode 100644 index 0000000..01283d2 --- /dev/null +++ b/src/tests/nal/test_operation.nal @@ -0,0 +1,67 @@ +' 用于测试CIN对「操作」的支持 +' * 📍所涉及NAL层级:NAL-7、NAL-8 +' ! ⚠️【2024-03-29 16:52:57】ONA不支持「有两个以上组分的乘积词项」,故使用(*, P1, P2)替代 +' * ONA特有「操作注册」语法:`*setopname 11 ^left` +' 输出预期 +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER 【CommonNarsese】` +' * 📄预期「操作」:`''expect-contains: EXE (^【操作名】, 【操作参数(CommonNarsese词项)】)` +' * 🚩【2024-04-03 02:10:19】有时对操作需要等待足够的时长,才能捕获到输出 +' 日志存储 +' * ✨存储所有「NAVM输出」到指定文件(JSON格式):`''save-outputs: 【文件相对路径】` +' * 📌以`.nal`文件自身所在目录为根目录 + +' 降低音量,减少无关输出 +' * 📄【2024-04-03 11:51:12】目前输出过多会造成CLI轻微卡顿 +' * 📝【2024-04-07 14:18:43】观察到输出过多会导致「未能截取操作」的事情发生 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + +' ⚠️【2024-04-07 14:58:12】对ONA使用会造成失败 +' '/REG left + +A. :|: +<(*, {SELF}) --> ^left>. :|: +G. :|: +' ? 📝【2024-04-07 14:10:03】OpenNARS相比于ONA,需要进行「提问」以「提示」需要操作 +' ! ⚠️不加下边这条问句,OpenNARS将测试失败 +<(&/, A, <(*, {SELF}) --> ^left>) ==> G>? +A. :|: +G! :|: +''expect-cycle(2000, 200, 0.2s): EXE (^left, {SELF}) +' * 🚩【2024-04-19 21:45:12】↑OpenNARS 3.x引入了大量心理操作,因此在「逐步递进」测试中性能不佳 +' * 📝【2024-04-19 21:46:42】OpenNARS 158、ONA、PyNARS等均能在5步之内回答 + +A2. :|: +<(*, {SELF}, P) --> ^left>. :|: +G2. :|: +' ? 📝【2024-04-07 14:10:03】OpenNARS相比于ONA,需要进行「提问」以「提示」需要操作 +' ! ⚠️不加下边这条问句,OpenNARS将测试失败 +<(&/, A2, <(*, {SELF}, P) --> ^left>) ==> G2>? +A2. :|: +G2! :|: +''expect-cycle(2000, 200, 0.2s): EXE (^left, {SELF}, P) +' * 🚩【2024-04-19 21:45:12】↑OpenNARS 3.x引入了大量心理操作,因此在「逐步递进」测试中性能不佳 +' * 📝【2024-04-19 21:46:42】OpenNARS 158、ONA、PyNARS等均能在5步之内回答 + +A3. :|: +<(*, {SELF}, (*, P1, P2)) --> ^left>. :|: +G3. :|: +' ? 📝【2024-04-07 14:10:03】OpenNARS相比于ONA,需要进行「提问」以「提示」需要操作 +' ! ⚠️不加下边这条问句,OpenNARS将测试失败 +<(&/, A3, <(*, {SELF}, (*, P1, P2)) --> ^left>) ==> G3>? +A3. :|: +G3! :|: +''expect-cycle(2000, 200, 0.2s): EXE (^left, {SELF}, (*, P1, P2)) +' * 🚩【2024-04-19 21:45:12】↑OpenNARS 3.x引入了大量心理操作,因此在「逐步递进」测试中性能不佳 +' * 📝【2024-04-19 21:46:42】OpenNARS 158、ONA、PyNARS等均能在5步之内回答 + +''sleep: 500ms + +' * 保存输出 +''save-outputs: nal_operation_outputs.log.json + +' * 终止CIN +''terminate(if-no-user) diff --git a/src/tests/nal/test_simple_deduction.nal b/src/tests/nal/test_simple_deduction.nal new file mode 100644 index 0000000..b581637 --- /dev/null +++ b/src/tests/nal/test_simple_deduction.nal @@ -0,0 +1,34 @@ +' 用于测试CIN的「简单演绎推理」 +' * 📍所涉及NAL层级:NAL-1 +' * 📝在「文件表示」上利用现有`Narsese`语法 +' +' 输出等待 `expect-contains` +' * 📝统一的NAL等待语法:`''await: 【输入类别】 【其它内容】` +' * ⚠️可能会阻塞测试,慎用 +' * 🚩以下await已被注释失效,仅作语法演示 +' +' 输出预期 `expect-contains` +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER 【CommonNarsese】` +' * 📄预期「操作」:`''expect-contains: EXE (^【操作名】, 【操作参数(CommonNarsese词项)】)` + +' 🚩降低音量,减少无关输出 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + + B>. +' // ''await: IN B>. +' * 🚩【2024-04-19 13:28:46】增加睡眠时间,以让OpenNARS 158、CXinNARS有时间输出 + C>. +' // ''await: IN C>. + C>? + +' 检验输出 | 每10步有0.25s睡眠延时,给足输出呈现时间 +''expect-cycle(100, 10, 0.25s): ANSWER C>. +' * 🚩【2024-04-19 21:45:12】↑OpenNARS 3.x引入了大量心理操作,因此在「逐步递进」测试中性能不佳 +' * 📝【2024-04-19 21:46:42】OpenNARS 158、ONA、PyNARS等均能在五步之内回答 + +' 用户无法输入时退出(正常退出) +''terminate(if-no-user) diff --git a/src/tests/nal/test_simple_operation.nal b/src/tests/nal/test_simple_operation.nal new file mode 100644 index 0000000..3b6c851 --- /dev/null +++ b/src/tests/nal/test_simple_operation.nal @@ -0,0 +1,34 @@ +' 用于测试CIN对「简单操作」的支持 +' * 📍所涉及NAL层级:NAL-8 +' * 📝原理:可直接执行的操作 as 目标 ⇒ 直接执行 +' 输出预期 +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER 【CommonNarsese】` +' * 📄预期「操作」:`''expect-contains: EXE (^【操作名】, 【操作参数(CommonNarsese词项)】)` +' * 🚩【2024-04-03 02:10:19】有时对操作需要等待足够的时长,才能捕获到输出 + +' 降低音量,减少无关输出 +' * 📄【2024-04-03 11:51:12】目前输出过多会造成CLI轻微卡顿 +' * 📝【2024-04-07 14:18:43】观察到输出过多会导致「未能截取操作」的事情发生 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + +' ⚠️【2024-04-07 14:58:12】对ONA使用会造成失败 +' '/REG left + +<(*, {SELF}) --> ^left>! :|: +' * 🚩一次性执行一百步(并延时等待),若无预期输出⇒上报 +''expect-cycle(100, 100, 0.25s): EXE (^left, {SELF}) + +<(*, {SELF}, P) --> ^left>! :|: +' * 🚩一次性执行一百步(并延时等待),若无预期输出⇒上报 +''expect-cycle(100, 100, 0.25s): EXE (^left, {SELF}, P) + +<(*, {SELF}, (*, P1, P2)) --> ^left>! :|: +' * 🚩一次性执行一百步(并延时等待),若无预期输出⇒上报 +''expect-cycle(100, 100, 0.25s): EXE (^left, {SELF}, (*, P1, P2)) + +''sleep: 500ms +''terminate(if-no-user) diff --git a/src/tests/nal/test_temporal_induction.nal b/src/tests/nal/test_temporal_induction.nal new file mode 100644 index 0000000..86bd533 --- /dev/null +++ b/src/tests/nal/test_temporal_induction.nal @@ -0,0 +1,36 @@ +' 用于测试CIN的「时间归纳推理」 +' * 📍所涉及NAL层级:NAL-7 +' * 📝在「文件表示」上利用现有`Narsese`语法 +' +' 输出等待 `expect-contains` +' * 📝统一的NAL等待语法:`''await: 【输入类别】 【其它内容】` +' * ⚠️可能会阻塞测试,慎用 +' * 🚩以下await已被注释失效,仅作语法演示 +' +' 输出预期 `expect-contains` +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER 【CommonNarsese】` +' * 📄预期「操作」:`''expect-contains: EXE (^【操作名】, 【操作参数(CommonNarsese词项)】)` + +' 🚩降低音量,减少无关输出 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + + B>. :|: +' // ''await: IN B>. + +5 + + D>. :|: +' // ''await: IN C>. + +< B> =/> D>>? + +' 检验输出 +''expect-cycle(500, 50, 0.25s): ANSWER < B> =/> D>>. +' * 🚩【2024-04-19 21:45:12】↑OpenNARS 3.x引入了大量心理操作,因此在「逐步递进」测试中性能不佳 + +' 用户无法输入时退出(正常退出) +''terminate(if-no-user) diff --git a/src/tests/nal/test_truth_wildcard.nal b/src/tests/nal/test_truth_wildcard.nal new file mode 100644 index 0000000..cea965a --- /dev/null +++ b/src/tests/nal/test_truth_wildcard.nal @@ -0,0 +1,22 @@ +' 用于测试BabelNAR CLI的「真值通配」功能 +' * 📍所涉及NAL层级:NAL-1 +' * 📝在「文件表示」上利用现有`Narsese`语法 +' +' 输出预期 `expect-contains` +' * 📝统一的NAL测试语法:`''expect-contains: 【输出类别】 【其它内容】` +' * 📄预期「回答」:`''expect-contains: ANSWER A. [可选的真值]` + +' 🚩降低音量,减少无关输出 +'/VOL 0 + +' 🚩【2024-04-07 14:22:28】兼容PyNARS:给启动留足时间 +''sleep: 0.5s + +A. +A? + +' 检验输出 | 每10步有0.25s睡眠延时,给足输出呈现时间 +''expect-cycle(100, 10, 0.25s): ANSWER A. + +' 用户无法输入时退出(正常退出) +''terminate(if-no-user)