こんにちは、
多くのセルでテーブルを操作するモジュールの単体テストを作成したい。だから私はテーブルのチェックサムに対してテストすることを考えた
すぐに使用できるテーブルのチェックサムを提供する関数が見つかりませんでした。
誰もそれを行う方法をきちんと考えていますか?
宜しくお願いします
ステファン
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}] ) ) ) ) );