Overview
Comment: | s_expressions-encodings-tests: add more tests to reach complete coverage |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b8a246ea77963ab2518ac705ba3e34b7 |
User & Date: | nat on 2014-01-03 21:26:07 |
Other Links: | manifest | tags |
Context
2014-01-04
| ||
13:00 | s_expressions-encodings: fix decoding of lone last half-byte check-in: 5d808b591d user: nat tags: trunk | |
2014-01-03
| ||
21:26 | s_expressions-encodings-tests: add more tests to reach complete coverage check-in: b8a246ea77 user: nat tags: trunk | |
2014-01-02
| ||
19:22 | coverage.sh: update the script for gcc-aux check-in: 0b249eb1b5 user: nat tags: trunk | |
Changes
Modified tests/natools-s_expressions-encodings-tests.adb from [c6d8373921] to [9abe5ffd1c].
1 | ------------------------------------------------------------------------------ | | > > < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ------------------------------------------------------------------------------ -- Copyright (c) 2013-2014, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- -- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- -- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- -- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- -- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- -- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- ------------------------------------------------------------------------------ with Ada.Exceptions; with Natools.S_Expressions.Test_Tools; package body Natools.S_Expressions.Encodings.Tests is procedure All_Tests (Report : in out NT.Reporter'Class) is begin Hexadecimal_Test (Report); Base64_Test (Report); end All_Tests; procedure Hexadecimal_Test (Report : in out NT.Reporter'Class) is All_Octets : Atom (1 .. 256); begin for I in All_Octets'Range loop |
︙ | ︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | (Report, Name, (16#01#, 16#23#, 16#45#, 16#67#, 16#89#, 16#AB#, 16#CD#, 16#EF#, 16#AB#, 16#CD#, 16#EF#), Decode_Hex (All_Octets)); exception when Error : others => Report.Report_Exception (Name, Error); end; end Hexadecimal_Test; procedure Base64_Test (Report : in out NT.Reporter'Class) is begin declare Name : constant String := "Decoding encoding of all octet triplets"; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | (Report, Name, (16#01#, 16#23#, 16#45#, 16#67#, 16#89#, 16#AB#, 16#CD#, 16#EF#, 16#AB#, 16#CD#, 16#EF#), Decode_Hex (All_Octets)); exception when Error : others => Report.Report_Exception (Name, Error); end; declare Name : constant String := "Decoding an odd number of nibbles"; begin Test_Tools.Test_Atom (Report, Name, (16#45#, 16#56#, 16#70#), Decode_Hex (To_Atom ("45 56 7"))); exception when Error : others => Report.Report_Exception (Name, Error); end; declare Name : constant String := "Decode_Hex with non-hex-digit"; Result : Octet; begin Result := Decode_Hex (180); Report.Item (Name, NT.Fail); Report.Info ("No exception raised. Result: " & Octet'Image (Result)); exception when Constraint_Error => Report.Item (Name, NT.Success); when Error : others => Report.Item (Name, NT.Fail); Report.Info ("Unexpected exception " & Ada.Exceptions.Exception_Name (Error) & " has been raised"); end; declare Name : constant String := "Overflow in Encode_Hex"; Result : Octet; begin Result := Encode_Hex (16, Lower); Report.Item (Name, NT.Fail); Report.Info ("No exception raised. Result: " & Octet'Image (Result)); exception when Constraint_Error => Report.Item (Name, NT.Success); when Error : others => Report.Item (Name, NT.Fail); Report.Info ("Unexpected exception " & Ada.Exceptions.Exception_Name (Error) & " has been raised"); end; end Hexadecimal_Test; procedure Base64_Test (Report : in out NT.Reporter'Class) is begin declare Name : constant String := "Decoding encoding of all octet triplets"; |
︙ | ︙ | |||
169 170 171 172 173 174 175 176 177 178 | if Success then Report.Item (Name, NT.Success); end if; exception when Error : others => Report.Report_Exception (Name, Error); end; end Base64_Test; end Natools.S_Expressions.Encodings.Tests; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | if Success then Report.Item (Name, NT.Success); end if; exception when Error : others => Report.Report_Exception (Name, Error); end; declare Name : constant String := "Decode_Base64 with non-base64-digit"; Result : Octet; begin Result := Decode_Base64 (127); Report.Item (Name, NT.Fail); Report.Info ("No exception raised. Result: " & Octet'Image (Result)); exception when Constraint_Error => Report.Item (Name, NT.Success); when Error : others => Report.Item (Name, NT.Fail); Report.Info ("Unexpected exception " & Ada.Exceptions.Exception_Name (Error) & " has been raised"); end; declare Name : constant String := "Overflow in Encode_Base64"; Result : Octet; begin Result := Encode_Base64 (64); Report.Item (Name, NT.Fail); Report.Info ("No exception raised. Result: " & Octet'Image (Result)); exception when Constraint_Error => Report.Item (Name, NT.Success); when Error : others => Report.Item (Name, NT.Fail); Report.Info ("Unexpected exception " & Ada.Exceptions.Exception_Name (Error) & " has been raised"); end; end Base64_Test; end Natools.S_Expressions.Encodings.Tests; |