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