你好
我想为在多个单元格中处理表格的模块创建单元测试。所以我想对照表的校验和进行测试
我找不到一个功能,它可以立即为您提供表的校验和。
有谁知道如何做到这一点?
最好的祝福
斯特凡
我建议使用BlobMD5函数。您可能要校验表中的数据而不是表的磁盘映像的校验和,因为JMP可能会向磁盘上的二进制数据添加日期,甚至在将来的发行版中更改格式。第一个示例可能不是您想要的单元测试。
// capture the md5 of the data the table saves to disk
Show(
Hex(/* make it printable */
Blob MD5(/* get the hash */
Load Text File(
"$SAMPLE_DATA/big class.jmp",
BLOB/* the result is a BLOB, not a string */
)
)
)
);
// capture the md5 of the script that will produce the table
dt = Open( "$SAMPLE_DATA/big class.jmp" );
Show( Hex( Blob MD5( Char To Blob( Char( dt << getscript ) ) ) ) );
// capture the md5 of some numeric columns in the table; avoids numeric to character conversions
Show( Hex( Blob MD5( Matrix To Blob( dt[0, {height, age, weight}], "float", 8, "little" ) ) ) );
// capture the md5 of some mixed columns in the table
Show( Hex( Blob MD5( Char To Blob( Char( dt[0, {name, height, age, weight}] ) ) ) ) );