raw
eucrypt_crc32_div...    1 ------------------------------------------------------------------------------
eucrypt_crc32_div... 2 ------------------------------------------------------------------------------
eucrypt_crc32_div... 3 -- This file is part of 'CRC32' --
eucrypt_crc32_div... 4 -- --
eucrypt_crc32_div... 5 -- You do not have, nor can you ever acquire the right to use, copy or --
eucrypt_crc32_div... 6 -- distribute this software ; Should you use this software for any purpose, --
eucrypt_crc32_div... 7 -- or copy and distribute it to anyone or in any manner, you are breaking --
eucrypt_crc32_div... 8 -- the laws of whatever soi-disant jurisdiction, and you promise to --
eucrypt_crc32_div... 9 -- continue doing so for the indefinite future. In any case, please --
eucrypt_crc32_div... 10 -- always : read and understand any software ; verify any PGP signatures --
eucrypt_crc32_div... 11 -- that you use - for any purpose. --
eucrypt_crc32_div... 12 -- --
eucrypt_crc32_div... 13 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
eucrypt_crc32_div... 14 ------------------------------------------------------------------------------
eucrypt_crc32_div... 15 ------------------------------------------------------------------------------
eucrypt_crc32_div... 16
eucrypt_crc32_div... 17 -- Basic test for the CRC32 implementation
eucrypt_crc32_div... 18 -- S.MG, 2018
eucrypt_crc32_div... 19
eucrypt_crc32_div... 20 with Ada.Text_IO; use Ada.Text_IO;
eucrypt_crc32_div... 21 with Interfaces; use Interfaces;
eucrypt_crc32_div... 22 with CRC32;
eucrypt_crc32_div... 23
eucrypt_crc32_div... 24 procedure Test_CRC32 is
eucrypt_crc32_div... 25 Input : constant String := "123456789";
eucrypt_crc32_div... 26 Expected : constant Unsigned_32 := 16#CBF4_3926#;
eucrypt_crc32_div... 27 Output : Unsigned_32;
eucrypt_crc32_div... 28 begin
eucrypt_crc32_div... 29 Output := CRC32.CRC(Input);
eucrypt_crc32_div... 30 if Output /= Expected then
eucrypt_crc32_div... 31 Put_Line("FAIL: CRC32(" & Input & ") returned " &
eucrypt_crc32_div... 32 Unsigned_32'Image(Output) & " instead of " &
eucrypt_crc32_div... 33 Unsigned_32'Image(Expected));
eucrypt_crc32_div... 34 else
eucrypt_crc32_div... 35 Put_Line("PASS: CRC32(" & Input & ") returned " &
eucrypt_crc32_div... 36 Unsigned_32'Image(Output) & " as expected.");
eucrypt_crc32_div... 37 end if;
eucrypt_crc32_div... 38
eucrypt_crc32_div... 39 end Test_CRC32;