class EL_CRC_32_TESTABLE

(source code)

Client examples: COMMA_SEPARATED_IMPORT_TEST_SETCOPIED_SVG_DIRECTORY_DATA_TEST_SETCREATEABLE_FROM_XPATH_MATCH_EVENTS_TEST_SETDOCUMENT_NODE_STRING_TEST_SETDOC_TYPE_TEST_SETECD_READER_WRITER_TEST_SETEVOLICITY_TEST_SETFEATURE_EDITOR_COMMAND_TEST_SETFILE_SYNC_MANAGER_TEST_SETFTP_PROTOCOL_TEST_SETI18N_LOCALIZATION_TEST_SETID3_TAG_INFO_TEST_SETJAVA_TEST_SETJSON_PARSING_TEST_SETLOCALE_COMPILER_TEST_SETMARKUP_ESCAPE_TEST_SETOBJECT_BUILDER_TEST_SETOPEN_OFFICE_TEST_SETPROTEIN_FOLDING_TEST_SETPYXIS_TO_XML_TEST_SET

description

Routines for use with EL_EQA_TEST_SET to do regression testing based on CRC-32 checksum of logged/console output. See do_test routine.

notes

The type of log must be set to EL_CRC_32_CONSOLE_ONLY_LOG by running the test from a sub-application conforming to EL_CRC_32_AUTOTEST_APPLICATION

note
	description: "[
		Routines for use with ${EL_EQA_TEST_SET} to do regression testing based on CRC-32 checksum
		of logged/console output. See **do_test** routine.
	]"
	notes: "[
		The type of `log' must be set to ${EL_CRC_32_CONSOLE_ONLY_LOG} by running the test
		from a sub-application conforming to ${EL_CRC_32_AUTOTEST_APPLICATION}
	]"

	author: "Finnian Reilly"
	copyright: "Copyright (c) 2001-2022 Finnian Reilly"
	contact: "finnian at eiffel hyphen loop dot com"

	license: "MIT license (See: en.wikipedia.org/wiki/MIT_License)"
	date: "2024-06-03 15:12:21 GMT (Monday 3rd June 2024)"
	revision: "18"

deferred class
	EL_CRC_32_TESTABLE

inherit
	EL_MODULE_FILE

	EL_MODULE_LOG

	EL_MODULE_LOG_MANAGER

	EL_SHARED_TEST_CRC

feature {NONE} -- Implementation

	assert (a_tag: READABLE_STRING_GENERAL; a_condition: BOOLEAN)
		deferred
		end

	do_test (name: STRING; target_checksum: NATURAL test: PROCEDURE; operands: TUPLE)
		require
			valid_lio: attached {EL_CRC_32_CONSOLE_AND_FILE_LOG} lio
			valid_log_manager: attached {EL_CRC_32_LOG_MANAGER} Log_manager
			valid_operands: test.valid_operands (operands)
		local
			actual_checksum: NATURAL
		do
			Test_crc.reset
			if operands.is_empty then
				log.enter (name)
			else
				log.enter_with_args (name, operands)
			end
			test.call (operands)
			log.exit

			actual_checksum := Test_crc.checksum
			log.put_new_line

			if target_checksum /= actual_checksum then
				log.put_natural_field ("Expected checksum", target_checksum)
				log.put_natural_field (" actual checksum", actual_checksum)
				log.put_new_line
				assert ("Routine %"" + name + "%" checksums agree", False)
			end
		end

end