Rhino C++ API
8.19
|
#include <opennurbs_extensions.h>
Public Types | |
enum | Result : unsigned char { Result::Unset = 0, Result::Fail = 1, Result::Errors = 2, Result::Warnings = 3, Result::Pass = 4, Result::Skip = 5 } |
ONX_ModelTest::Result reports the result of a test. More... | |
enum | Type : unsigned char { Type::Unset = 0, Type::Read = 1, Type::ReadWrite = 2, Type::ReadWriteRead = 3, Type::ReadWriteReadCompare = 4 } |
ONX_ModelTest::Type identifies the type of file reading test to perform. More... | |
Public Member Functions | |
ONX_ModelTest ()=default | |
ONX_ModelTest (const ONX_ModelTest &)=default | |
~ONX_ModelTest ()=default | |
void | Dump (ON_TextLog &text_log) const |
bool | DumpHashLogs (ON_wString &source_model_hash_log_filename, ON_SHA1_Hash &source_model_hash, ON_wString ©_model_hash_log_filename, ON_SHA1_Hash ©_model_hash) const |
The read-write-read-compare test 1.) Reads the source model and calculates a SHA-1 hash of its contents. 2.) Writes the source model to a temporary archive. 3.) Reads the temporary archive and calculates a SHA-1 hash of its contents. 4.) Compares the SHA-1 hashes from step 1 and step 3. If those hashes are equal, then the read-write-read-compare test passes. If those hashes are different, the test fails. When the test fails, use this function to save the information used to compute the hashes in human readable text files that can be compared using a text compare tool. The differences between the text files will tell you what caused the hashes to be different. More... | |
bool | DumpReadWriteReadModel () const |
bool | DumpReadWriteReadModel (const wchar_t *text_file_full_path) const |
bool | DumpReadWriteReadModel (ON_TextLog &text_log) const |
bool | DumpSourceModel () const |
bool | DumpSourceModel (const wchar_t *text_file_full_path) const |
bool | DumpSourceModel (ON_TextLog &text_log) const |
ONX_ErrorCounter | ErrorCounter () const |
ONX_ErrorCounter | ErrorCounter (ONX_ModelTest::Type test_type) const |
ONX_ModelTest & | operator= (const ONX_ModelTest &)=default |
bool | ReadTest (const char *file_path, ONX_ModelTest::Type test_type, bool bKeepModels, const char *text_log_file_path, ON_TextLog *text_log) |
bool | ReadTest (const wchar_t *file_path, ONX_ModelTest::Type test_type, bool bKeepModels, const wchar_t *text_log_file_path, ON_TextLog *text_log) |
bool | ReadTest (FILE *fp, ONX_ModelTest::Type test_type, bool bKeepModels, const wchar_t *text_log_file_path, ON_TextLog *text_log) |
bool | ReadTest (ON_BinaryArchive &archive, ONX_ModelTest::Type test_type, bool bKeepModels, const wchar_t *text_log_file_path, ON_TextLog *text_log) |
std::shared_ptr< ONX_Model > | ReadWriteReadModel () const |
const ON_SHA1_Hash | ReadWriteReadModelHash () |
const ON_wString | Source3dmFilePath () const |
unsigned int | Source3dmFileVersion () const |
std::shared_ptr< ONX_Model > | SourceModel () const |
const ON_SHA1_Hash | SourceModelHash () |
ONX_ModelTest::Result | TestResult () const |
ONX_ModelTest::Result | TestResult (ONX_ModelTest::Type test_type) |
ONX_ModelTest::Type | TestType () const |
Test that was performed. More... | |
const ON_wString | TextLogSource3dmFilePath () const |
Static Public Member Functions | |
static bool | DumpModel (const ONX_Model *model, ON_TextLog &text_log) |
static ONX_ModelTest::Result | ResultFromErrorCounter (ONX_ErrorCounter error_count, ONX_ModelTest::Result no_errors_result) |
static const char * | ResultToString (ONX_ModelTest::Result result) |
static const wchar_t * | ResultToWideString (ONX_ModelTest::Result result) |
static bool | SkipCompare (unsigned int source_3dm_file_version) |
static const char * | TestTypeToString (ONX_ModelTest::Type test_type) |
static const wchar_t * | TestTypeToWideString (ONX_ModelTest::Type test_type) |
static ONX_ModelTest::Result | WorstResult (ONX_ModelTest::Result a, ONX_ModelTest::Result b) |
Static Public Attributes | |
static const ONX_ModelTest | Unset |
|
strong |
ONX_ModelTest::Result reports the result of a test.
|
strong |
ONX_ModelTest::Type identifies the type of file reading test to perform.
< XXRH_C_SHARED_ENUM ///< [ONX_ModelTest::Type] [Rhino.Geometry.Something.Type] [nested:byte]
Enumerator | |
---|---|
Unset | summary> Read the source 3dm file. /summary> |
Read | summary> Read the source 3dm file and write one or two temporary 3dm files. The original source file is not modified. If the 3dm version of the source file is < ON_BinaryArchive::CurrentArchiveVersion(), then two temporary 3dm files are written, the first with 3dm version = ON_BinaryArchive::CurrentArchiveVersion()-10 and the second with 3dm version = ON_BinaryArchive::CurrentArchiveVersion(). For example, if Rhino 6 is the current version of Rhino and a file written by Rhino 5 is read, then both a temporary Rhino 5 and a temporary Rhino 6 3dm file are written. /summary> |
ReadWrite | summary> Perform the ReadWrite test and read the temporary files. /summary> |
ReadWriteRead | summary> Perform the ReadWriteRead test. If one of the temporary files has the same 3dm version as the original source file, verify that the ONX_Models created by reading the original 3dm file and the temporary 3dm file with the same version have identical values of ONX_Model::ContentHash(). /summary> |
ReadWriteReadCompare |
|
default |
|
default |
|
default |
void ONX_ModelTest::Dump | ( | ON_TextLog & | text_log | ) | const |
Description: Prints test results.
bool ONX_ModelTest::DumpHashLogs | ( | ON_wString & | source_model_hash_log_filename, |
ON_SHA1_Hash & | source_model_hash, | ||
ON_wString & | copy_model_hash_log_filename, | ||
ON_SHA1_Hash & | copy_model_hash | ||
) | const |
The read-write-read-compare test 1.) Reads the source model and calculates a SHA-1 hash of its contents. 2.) Writes the source model to a temporary archive. 3.) Reads the temporary archive and calculates a SHA-1 hash of its contents. 4.) Compares the SHA-1 hashes from step 1 and step 3. If those hashes are equal, then the read-write-read-compare test passes. If those hashes are different, the test fails. When the test fails, use this function to save the information used to compute the hashes in human readable text files that can be compared using a text compare tool. The differences between the text files will tell you what caused the hashes to be different.
source_model_hash_log_filename | The name of the text file containing the hashed text description of the source model is returned here. |
source_model_hash | The hash of the source model is returned here. |
copy_model_hash_log_filename | The name of the text file containing the hashed text description of the read-write-read model is returned here. |
copy_model_hash | The hash of the read-write-read model is returned here. |
|
static |
Description: Prints the model context to text_log.
bool ONX_ModelTest::DumpReadWriteReadModel | ( | ) | const |
Description: Prints the model obtained from the last read in the read-write-read test to with the file ONX_ModelText_copy<PLATFORM>.txt appended to the original source file name. Remark: Call after test is completed.
bool ONX_ModelTest::DumpReadWriteReadModel | ( | const wchar_t * | text_file_full_path | ) | const |
Description: Prints the model obtained from the last read in the read-write-read test to with the file ONX_ModelText_copy<PLATFORM>.txt appended to a text file with the specified name. Remark: Call after test is completed.
bool ONX_ModelTest::DumpReadWriteReadModel | ( | ON_TextLog & | text_log | ) | const |
Description: Prints the model obtained from the last read in the read-write-read test to with the file ONX_ModelText_copy<PLATFORM>.txt appended to the text_log. Remark: Call after test is completed.
bool ONX_ModelTest::DumpSourceModel | ( | ) | const |
Description: Prints the source model context to text file next to the source file with the file ONX_ModelText_original<PLATFORM>.txt appended to the source file name. Remark: Call after test is completed.
bool ONX_ModelTest::DumpSourceModel | ( | const wchar_t * | text_file_full_path | ) | const |
Description: Prints the source model context to text_log. Remark: Call after test is completed.
bool ONX_ModelTest::DumpSourceModel | ( | ON_TextLog & | text_log | ) | const |
Description: Prints the source model context to text_log. Remark: Call after test is completed.
ONX_ErrorCounter ONX_ModelTest::ErrorCounter | ( | ) | const |
Returns: Total number of failures, errors, and warnings for all tests that were performed.
ONX_ErrorCounter ONX_ModelTest::ErrorCounter | ( | ONX_ModelTest::Type | test_type | ) | const |
Returns: Total number of failures, errors, and warnings for all tests that were performed.
|
default |
bool ONX_ModelTest::ReadTest | ( | const char * | file_path, |
ONX_ModelTest::Type | test_type, | ||
bool | bKeepModels, | ||
const char * | text_log_file_path, | ||
ON_TextLog * | text_log | ||
) |
Description: Test ONX_Model::Read() and ONX_Model::Write(). Parameters: file_path - [in] file path test_type - [in] test to perform. bKeepModels - [in] If true, then the ONX_Models created by reading 3dm archives are saved so the can be examined after the tests complete. text_log_file_path - [in] If not empty, the string to use for file_path in the output text_log. This is used to create logs on different computers that can be compared. text_log - [in] If text_log is not nullptr, then a summary of the test is sent to text_log. Returns: True if every test passed with no warnings or errors. False if a test failed or warnings or errors occurred.
bool ONX_ModelTest::ReadTest | ( | const wchar_t * | file_path, |
ONX_ModelTest::Type | test_type, | ||
bool | bKeepModels, | ||
const wchar_t * | text_log_file_path, | ||
ON_TextLog * | text_log | ||
) |
Description: ONX_Model::ReadTest() can be used to test reading a specific file. Parameters: file_path - [in] file path test_type - [in] test to perform. bKeepModels - [in] If true, then the ONX_Models created by reading 3dm archives are saved so the can be examined after the tests complete. text_log_file_path - [in] If not empty, the string to use for file_path in the output text_log. This is used to create logs on different computers that can be compared. text_log - [in] If text_log is not nullptr, then a summary of the test is sent to text_log. Returns: True if every test passed with no warnings or errors. False if a test failed or warnings or errors occurred.
bool ONX_ModelTest::ReadTest | ( | FILE * | fp, |
ONX_ModelTest::Type | test_type, | ||
bool | bKeepModels, | ||
const wchar_t * | text_log_file_path, | ||
ON_TextLog * | text_log | ||
) |
Description: ONX_Model::ReadTest() can be used to test reading a specific file. Parameters: fp - [in] fp pointer to a file opened with ON_FileStream::Opent(...,"rb"); test_type - [in] test to perform. bKeepModels - [in] If true, then the ONX_Models created by reading 3dm archives are saved so the can be examined after the tests complete. text_log_file_path - [in] If not empty, the string to use for file_path in the output text_log. This is used to create logs on different computers that can be compared. text_log - [in] If text_log is not nullptr, then a summary of the test is sent to text_log. Returns: True if every test passed with no warnings or errors. False if a test failed or warnings or errors occurred.
bool ONX_ModelTest::ReadTest | ( | ON_BinaryArchive & | archive, |
ONX_ModelTest::Type | test_type, | ||
bool | bKeepModels, | ||
const wchar_t * | text_log_file_path, | ||
ON_TextLog * | text_log | ||
) |
Description: ONX_Model::Test() can be used to test reading a specific file. Parameters: archive - [in]
test_type - [in] test to perform. bKeepModels - [in] If true, then the ONX_Models created by reading 3dm archives are saved so the can be examined after the tests complete. text_log_file_path - [in] If not empty, the string to use for file_path in the output text_log. This is used to create logs on different computers that can be compared. text_log - [in] If text_log is not nullptr, then a summary of the test is sent to text_log. Returns: True if every test passed with no warnings or errors. False if a test failed or warnings or errors occurred.
std::shared_ptr<ONX_Model> ONX_ModelTest::ReadWriteReadModel | ( | ) | const |
Returns: nullptr if the read write read test was not performed or was run with bKeepModels=false. Otherwise, a pointer to the result of the read write read test.
const ON_SHA1_Hash ONX_ModelTest::ReadWriteReadModelHash | ( | ) |
|
static |
Parameters: error_count - [in] no_errors_result - [in] result to return when 0 = error_count.TotalCount().
|
static |
|
static |
|
static |
const ON_wString ONX_ModelTest::Source3dmFilePath | ( | ) | const |
Returns: The name of the source 3dm file.
unsigned int ONX_ModelTest::Source3dmFileVersion | ( | ) | const |
Returns: Version of the 3dm fie, 1,2,3,4,5,50,60,...
std::shared_ptr<ONX_Model> ONX_ModelTest::SourceModel | ( | ) | const |
Returns: nullptr if the test was run with bKeepModels=false or the source archive could not be read. Otherwise, a pointer to the source model.
const ON_SHA1_Hash ONX_ModelTest::SourceModelHash | ( | ) |
ONX_ModelTest::Result ONX_ModelTest::TestResult | ( | ) | const |
Returns: Worst result for any test that was attempted.
ONX_ModelTest::Result ONX_ModelTest::TestResult | ( | ONX_ModelTest::Type | test_type | ) |
Parameters: test_type - [in] Returns: Result of the test identified by the test_type parameter.
ONX_ModelTest::Type ONX_ModelTest::TestType | ( | ) | const |
Test that was performed.
|
static |
|
static |
XXRH_C_SHARED_ENUM ///< [ONX_ModelTest::Result] [Rhino.Geometry.Something.Result] [nested:byte]
const ON_wString ONX_ModelTest::TextLogSource3dmFilePath | ( | ) | const |
Returns: The string used in the output log to identify the source 3dm file.
|
static |
|
static |