你好
我想為在多個單元格中處理表格的模塊創建單元測試。所以我想對錶的校驗和進行測試
我找不到一個功能,它可以立即為您提供表的校驗和。
有誰知道如何做到這一點?
最好的祝福
斯特凡
我建議使用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}] ) ) ) ) );