Hola,
Quiero crear una prueba unitaria para un módulo que manipula una tabla en muchas celdas. Entonces pensé probar contra una suma de comprobación de la tabla
No pude encontrar una función que te dé una suma de verificación para una tabla lista para usar.
¿Alguien tiene una idea clara de cómo hacerlo?
Atentamente
Stefan
Sugeriría usar la función BlobMD5. Es posible que desee sumar los datos dentro de la tabla en lugar de la imagen de disco de la tabla porque JMP podría agregar una fecha a los datos binarios en el disco o incluso cambiar el formato en una versión futura. El primer ejemplo probablemente NO sea lo que desea para una prueba unitaria.
// 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}] ) ) ) ) );