Ciao,
Voglio creare un test unitario per un modulo che manipola una tabella in molte celle. Quindi ho pensato di provare contro un checksum del tavolo
Non sono riuscito a trovare una funzione che ti dia un checksum per un tavolo pronto all'uso.
Qualcuno ha la netta idea di come farlo?
I migliori saluti
Stefan
Suggerirei di usare la funzione BlobMD5. È possibile che si desideri eseguire il checksum dei dati all'interno della tabella anziché sull'immagine del disco della tabella poiché JMP potrebbe aggiungere una data ai dati binari sul disco o persino modificare il formato in una versione futura. Il primo esempio probabilmente NON è quello che vuoi per un test unitario.
// 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}] ) ) ) ) );