Skip to content

Commit

Permalink
test: ✅ 测试支持OpenNARS 1.5.8
Browse files Browse the repository at this point in the history
添加对定制版OpenNARS 1.5.8的测试支持,包括配置和测试代码;更新测试文件,加入延迟以等待OpenNARS 1.5.8输出
  • Loading branch information
ARCJ137442 committed Apr 19, 2024
1 parent 5f92c98 commit 6bb800e
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "babel_nar"
version = "0.21.1"
version = "0.21.2"
edition = "2021"
description = """
Implementation and application supports of the NAVM model
Expand Down
38 changes: 36 additions & 2 deletions src/bin/babelnar_cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ mod tests {
ONA;

/// 简单演绎
/// * 📝✅【2024-04-07 14:56:04】成功
/// * 📝✅【2024-04-19 13:28:21】成功
nal_de => NAL_SIMPLE_DEDUCTION

/// 高阶演绎
Expand All @@ -217,7 +217,7 @@ mod tests {
}
}

/// 测试/OpenNARS
/// 测试/OpenNARS (3.x)
mod opennars {
use super::*;

Expand Down Expand Up @@ -251,6 +251,40 @@ mod tests {
}
}

/// 测试/OpenNARS (1.5.8)
mod opennars158 {
use super::*;

cin_tests! {
#[ignore = "【2024-04-14 20:24:52】会导致残留子进程"]
OPENNARS_158;

/// 简单演绎
/// * 📝✅【2024-04-19 13:28:27】成功
nal_de => NAL_SIMPLE_DEDUCTION

/// 高阶演绎
/// * 📝✅【2024-04-19 13:39:16】成功
nal_hi => NAL_HIGHER_DEDUCTION

/// 自变量消除
/// * 📝✅【2024-04-19 13:39:23】成功
nal_ie => NAL_I_VAR_ELIMINATION

/// 时间归纳
/// * 📝❌【2024-04-19 13:30:25】失败:语法层面就不支持
nal_te => NAL_TEMPORAL_INDUCTION

/// 简单操作
/// * 📝❌【2024-04-19 13:30:25】失败:没有任何输出
nal_so => NAL_SIMPLE_OPERATION

/// 操作
/// * 📝❌【2024-04-19 13:30:25】失败:语法层面就不支持
nal_op => NAL_OPERATION
}
}

/// 测试/PyNARS
mod pynars {
use super::*;
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ pub mod tests {

/// OpenNARS
OPENNARS = "./src/tests/cli/config/cin_opennars.hjson"
/// OpenNARS
OPENNARS_158 = "./src/tests/cli/config/cin_opennars_158.hjson"
/// ONA
ONA = "./src/tests/cli/config/cin_ona.hjson"
/// PyNARS
Expand Down
3 changes: 1 addition & 2 deletions src/tests/cli/config/cin_opennars.hjson
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#hjson
// * 📌包含OpenNARS转译器 及其jar启动的命令配置
// * 🎯用于测试「预加载NAL输入」,加载「简单演绎推理」
// OpenNARS 3.0.4 的启动配置
{
// 转译器
translators: "opennars"
Expand Down
23 changes: 23 additions & 0 deletions src/tests/cli/config/cin_opennars_158.hjson
Original file line number Diff line number Diff line change
@@ -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
}
}
3 changes: 3 additions & 0 deletions src/tests/nal/test_higher_deduction.nal
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@

<<A --> B> ==> <C --> D>>.
' // ''await: IN <<A --> B> ==> <C --> D>>.
''sleep: 0.05s
' * 🚩【2024-04-19 13:28:46】增加睡眠时间,以让OpenNARS 158、CXinNARS有时间输出
<A --> B>.
' // ''await: IN <A --> B>.
''sleep: 0.05s
<C --> D>?
5

Expand Down
3 changes: 3 additions & 0 deletions src/tests/nal/test_i_var_elimination.nal
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
''sleep: 0.5s

<A --> B>.
''sleep: 0.05s
' * 🚩【2024-04-19 13:28:46】增加睡眠时间,以让OpenNARS 158、CXinNARS有时间输出
<<A --> $1> ==> <$1 --> C>>.
''sleep: 0.05s
<B --> C>?
100

Expand Down
3 changes: 3 additions & 0 deletions src/tests/nal/test_simple_deduction.nal
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@

<A --> B>.
' // ''await: IN <A --> B>.
''sleep: 0.05s
' * 🚩【2024-04-19 13:28:46】增加睡眠时间,以让OpenNARS 158、CXinNARS有时间输出
<B --> C>.
' // ''await: IN <B --> C>.
''sleep: 0.05s
<A --> C>?
5

Expand Down

0 comments on commit 6bb800e

Please sign in to comment.