Overview
Comment: | smaz_tests: add a test for base-64 variable-length verbatim |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3e04c004e7002765c09a16be1f884626 |
User & Date: | nat on 2017-01-06 22:44:02 |
Other Links: | manifest | tags |
Context
2017-01-07
| ||
22:53 |
smaz_implementations-base_64: rewrite variable-length verbatim code
At some point in the development I changed the base-64 scheme, but failed to propagate it everywhere. Mostly I intend to use only one mode in base-64, and the other one is merely a place-holder, which explains how it got neglected. Now at least it works, even if it's useless. check-in: 210677c061 user: nat tags: trunk | |
2017-01-06
| ||
22:44 | smaz_tests: add a test for base-64 variable-length verbatim check-in: 3e04c004e7 user: nat tags: trunk | |
2017-01-05
| ||
22:56 | Add an ignore file check-in: 1877439212 user: nat tags: trunk | |
Changes
Modified tests/natools-smaz_tests.adb from [897c0b23ae] to [520f81491b].
︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | + + + + + + + + + + + + + + + + + | & Character'Val (16#C3#) & Character'Val (16#A9#) & "pd de lere ld" & "e" & LF & "on cqumede mentes aiquen teerou r sque , is m q" & "ue" & Character'Val (16#C3#) & Character'Val (16#A0#) & " v'tiweblogfanj." & LF & LF & "ch", Hash => Natools.Smaz_Test_Base_64_Hash.Hash'Access); Dict_64_V : constant Natools.Smaz_64.Dictionary := (Last_Code => 59, Values_Last => 119, Variable_Length_Verbatim => True, Max_Word_Length => 6, Offsets => (2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 16, 18, 20, 22, 24, 25, 26, 28, 30, 31, 32, 36, 38, 40, 42, 44, 45, 47, 49, 51, 53, 56, 60, 63, 65, 68, 70, 72, 74, 76, 80, 82, 84, 88, 90, 92, 94, 98, 101, 102, 103, 105, 111, 112, 114, 115, 118), Values => " ee stainruos l dt enescm p" & Character'Val (16#C3#) & Character'Val (16#A9#) & "pd de lere ld" & "e" & LF & "on cqumede mentes aiquen teerou r sque , is m q" & "ue" & Character'Val (16#C3#) & Character'Val (16#A0#) & " v'tiweblogfanj." & LF & LF & "ch", Hash => Natools.Smaz_Test_Base_64_Hash.Hash'Access); ------------------------------ -- Local Helper Subprograms -- ------------------------------ function Decimal_Image (S : Ada.Streams.Stream_Element_Array) return String |
︙ | |||
203 204 205 206 207 208 209 210 211 212 213 214 215 216 | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | + | end All_Tests_256; procedure All_Tests_64 (Report : in out NT.Reporter'Class) is begin Test_Validity_64 (Report); Sample_Strings_64 (Report); Sample_Strings_VLV_64 (Report); end All_Tests_64; ------------------------------- -- Individual Base-256 Tests -- ------------------------------- |
︙ | |||
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | To_SEA ("Uz9DjKHBi")); -- év<è >nement -- è 110000_11 0001_0101 00 exception when Error : others => Test.Report_Exception (Error); end Sample_Strings_64; procedure Sample_Strings_VLV_64 (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Roundtrip on sample strings with variable-length verbatim"); begin Roundtrip_Test (Test, Dict_64_V, "Simple Test", To_SEA ("+TBGSVYA+UBQE")); -- <S>imp* <T>*t Roundtrip_Test (Test, Dict_64_V, "SiT", To_SEA ("8TlGV")); -- <SiT> smaller than <S>i<T> ("+TBG+UB") Roundtrip_Test (Test, Dict_64_V, "sIMple TEST_WITH_14_B", To_SEA ("D9J1EVYA/KUVETR1XXlEVI9VM08lQ")); -- s<IM>p* < TE ST_ WIT H_1 4_B> -- TE 001010_10 1010_0010 00 -- ST_ 110010_10 0010_1010 11_111010 -- WIT 111010_10 1001_0010 00_101010 -- H_1 000100_10 1111_1010 10_001100 -- 4_B 001011_00 1111_1010 01_000010 Roundtrip_Test (Test, Dict_64_V, "'7B_Verbatim'", To_SEA ("0/D3AC9lVlJnYF1S0")); -- '< 7B_Verb >a*m' -- 7 111011_00 0000 -- B_V 010000_10 1111_1010 01_101010 -- erb 101001_10 0100_1110 01_000110 exception when Error : others => Test.Report_Exception (Error); end Sample_Strings_VLV_64; procedure Test_Validity_64 (Report : in out NT.Reporter'Class) is Test : NT.Test := Report.Item ("Test dictionary validity"); begin if not Natools.Smaz_64.Is_Valid (Dict_64) then Test.Fail; end if; if not Natools.Smaz_64.Is_Valid (Dict_64_V) then Test.Fail; end if; exception when Error : others => Test.Report_Exception (Error); end Test_Validity_64; end Natools.Smaz_Tests; |
Modified tests/natools-smaz_tests.ads from [2879f6cc4e] to [f7b2390338].
︙ | |||
25 26 27 28 29 30 31 32 33 34 | 25 26 27 28 29 30 31 32 33 34 35 | + | procedure All_Tests_256 (Report : in out NT.Reporter'Class); procedure All_Tests_64 (Report : in out NT.Reporter'Class); procedure Sample_Strings_256 (Report : in out NT.Reporter'Class); procedure Test_Validity_256 (Report : in out NT.Reporter'Class); procedure Sample_Strings_64 (Report : in out NT.Reporter'Class); procedure Sample_Strings_VLV_64 (Report : in out NT.Reporter'Class); procedure Test_Validity_64 (Report : in out NT.Reporter'Class); end Natools.Smaz_Tests; |