blob: baa708eea3b308157bb51671da728690755a8fbe [file] [log] [blame]
Holger Hans Peter Freytherb79a1482014-01-02 13:55:00 +01001Plain dump
200 01 02 03
Neels Hofmeyr0423b612019-01-14 23:32:53 +0100300010203
Holger Hans Peter Freytherb79a1482014-01-02 13:55:00 +01004Corner case
500 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54
Nils O. SelÄsdal32447022014-01-02 14:04:43 +01006000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfe
Neels Hofmeyr0423b612019-01-14 23:32:53 +01007osmo_hexdump_buf(buf, sizeof(buf), data, 4, "[delim]", false)
8 = "00[delim]01[delim]02[delim]03"
9osmo_hexdump_buf(buf, sizeof(buf), data, 4, "[delim]", true)
10 = "00[delim]01[delim]02[delim]03[delim]"
11osmo_hexdump_buf(buf, 6, data, 4, "[delim]", false)
12 = ""
13osmo_hexdump_buf(buf, 7, data, 4, "[delim]", false)
14 = ""
15osmo_hexdump_buf(buf, 8, data, 4, "[delim]", false)
16 = ""
17osmo_hexdump_buf(buf, 6, data, 4, "[delim]", true)
18 = ""
19osmo_hexdump_buf(buf, 7, data, 4, "[delim]", true)
20 = ""
21osmo_hexdump_buf(buf, 8, data, 4, "[delim]", true)
22 = ""
23osmo_hexdump_buf(buf, sizeof(buf), data, 4, " ", false)
24 = "00 01 02 03"
25osmo_hexdump_buf(buf, sizeof(buf), data, 4, " ", true)
26 = "00 01 02 03 "
27osmo_hexdump_buf(buf, 6, data, 4, " ", false)
28 = "00 "
29osmo_hexdump_buf(buf, 7, data, 4, " ", false)
30 = "00 01 "
31osmo_hexdump_buf(buf, 8, data, 4, " ", false)
32 = "00 01 "
33osmo_hexdump_buf(buf, 6, data, 4, " ", true)
34 = "00 "
35osmo_hexdump_buf(buf, 7, data, 4, " ", true)
36 = "00 01 "
37osmo_hexdump_buf(buf, 8, data, 4, " ", true)
38 = "00 01 "
39osmo_hexdump_buf(buf, sizeof(buf), data, 4, ":", false)
40 = "00:01:02:03"
41osmo_hexdump_buf(buf, sizeof(buf), data, 4, ":", true)
42 = "00:01:02:03:"
43osmo_hexdump_buf(buf, 6, data, 4, ":", false)
44 = "00:"
45osmo_hexdump_buf(buf, 7, data, 4, ":", false)
46 = "00:01:"
47osmo_hexdump_buf(buf, 8, data, 4, ":", false)
48 = "00:01:"
49osmo_hexdump_buf(buf, 6, data, 4, ":", true)
50 = "00:"
51osmo_hexdump_buf(buf, 7, data, 4, ":", true)
52 = "00:01:"
53osmo_hexdump_buf(buf, 8, data, 4, ":", true)
54 = "00:01:"
55osmo_hexdump_buf(buf, sizeof(buf), data, 4, "::", false)
56 = "00::01::02::03"
57osmo_hexdump_buf(buf, sizeof(buf), data, 4, "::", true)
58 = "00::01::02::03::"
59osmo_hexdump_buf(buf, 6, data, 4, "::", false)
60 = "00::"
61osmo_hexdump_buf(buf, 7, data, 4, "::", false)
62 = "00::"
63osmo_hexdump_buf(buf, 8, data, 4, "::", false)
64 = "00::"
65osmo_hexdump_buf(buf, 6, data, 4, "::", true)
66 = "00::"
67osmo_hexdump_buf(buf, 7, data, 4, "::", true)
68 = "00::"
69osmo_hexdump_buf(buf, 8, data, 4, "::", true)
70 = "00::"
71osmo_hexdump_buf(buf, sizeof(buf), data, 4, "", false)
72 = "00010203"
73osmo_hexdump_buf(buf, sizeof(buf), data, 4, "", true)
74 = "00010203"
75osmo_hexdump_buf(buf, 6, data, 4, "", false)
76 = "0001"
77osmo_hexdump_buf(buf, 7, data, 4, "", false)
78 = "000102"
79osmo_hexdump_buf(buf, 8, data, 4, "", false)
80 = "000102"
81osmo_hexdump_buf(buf, 6, data, 4, "", true)
82 = "0001"
83osmo_hexdump_buf(buf, 7, data, 4, "", true)
84 = "000102"
85osmo_hexdump_buf(buf, 8, data, 4, "", true)
86 = "000102"
87osmo_hexdump_buf(buf, sizeof(buf), data, 4, NULL, false)
88 = "00010203"
89osmo_hexdump_buf(buf, sizeof(buf), data, 4, NULL, true)
90 = "00010203"
91osmo_hexdump_buf(buf, 6, data, 4, NULL, false)
92 = "0001"
93osmo_hexdump_buf(buf, 7, data, 4, NULL, false)
94 = "000102"
95osmo_hexdump_buf(buf, 8, data, 4, NULL, false)
96 = "000102"
97osmo_hexdump_buf(buf, 6, data, 4, NULL, true)
98 = "0001"
99osmo_hexdump_buf(buf, 7, data, 4, NULL, true)
100 = "000102"
101osmo_hexdump_buf(buf, 8, data, 4, NULL, true)
102 = "000102"
Neels Hofmeyr7adb5672017-02-14 15:48:19 +0100103
104Hexparse 0..255 in lower case
105rc = 256
106--> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff
107
108Hexparse 0..255 in upper case
109rc = 256
110--> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff
111
112Hexparse 0..255 in mixed case
113rc = 256
114--> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff
115
Neels Hofmeyr437ed4a2017-02-14 15:54:31 +0100116Hexparse 0..255 with whitespace
117rc = 256
118--> 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f 90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 aa ab ac ad ae af b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 ba bb bc bd be bf c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca cb cc cd ce cf d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 da db dc dd de df e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 ea eb ec ed ee ef f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff
119
Neels Hofmeyr7adb5672017-02-14 15:48:19 +0100120Hexparse with buffer too short
121rc = -1
122Hexparse with uneven amount of digits
123rc = -1
124Hexparse with invalid char
125rc = -1
Neels Hofmeyr4335bad2017-10-07 04:39:14 +0200126
Harald Welte7869baf2018-07-31 20:25:48 +0200127Testing IPA CCM ID GET parsing
128
129Testing IPA CCM ID RESP parsing
130
Neels Hofmeyr4335bad2017-10-07 04:39:14 +0200131----- test_is_hexstr
132 0: pass str='(null)' min=0 max=10 even=0 expect=valid
133 1: pass str='(null)' min=1 max=10 even=0 expect=invalid
134 2: pass str='' min=0 max=10 even=0 expect=valid
135 3: pass str='' min=1 max=10 even=0 expect=invalid
136 4: pass str=' ' min=0 max=10 even=0 expect=invalid
137 5: pass str='1' min=0 max=10 even=0 expect=valid
138 6: pass str='1' min=1 max=10 even=0 expect=valid
139 7: pass str='1' min=1 max=10 even=1 expect=invalid
140 8: pass str='1' min=2 max=10 even=0 expect=invalid
141 9: pass str='123' min=1 max=10 even=0 expect=valid
14210: pass str='123' min=1 max=10 even=1 expect=invalid
14311: pass str='123' min=4 max=10 even=0 expect=invalid
14412: pass str='1234' min=4 max=10 even=1 expect=valid
14513: pass str='12345' min=4 max=10 even=1 expect=invalid
14614: pass str='123456' min=4 max=10 even=1 expect=valid
14715: pass str='1234567' min=4 max=10 even=1 expect=invalid
14816: pass str='12345678' min=4 max=10 even=1 expect=valid
14917: pass str='123456789' min=4 max=10 even=1 expect=invalid
15018: pass str='123456789a' min=4 max=10 even=1 expect=valid
15119: pass str='123456789ab' min=4 max=10 even=1 expect=invalid
15220: pass str='123456789abc' min=4 max=10 even=1 expect=invalid
15321: pass str='123456789ab' min=4 max=10 even=0 expect=invalid
15422: pass str='123456789abc' min=4 max=10 even=0 expect=invalid
15523: pass str='0123456789abcdefABCDEF' min=0 max=100 even=0 expect=valid
15624: pass str='0123456789 abcdef ABCDEF' min=0 max=100 even=0 expect=invalid
15725: pass str='foobar' min=0 max=100 even=0 expect=invalid
15826: pass str='BeadedBeeAced1EbbedDefacedFacade' min=32 max=32 even=1 expect=valid
15927: pass str='C01ffedC1cadaeAc1d1f1edAcac1aB0a' min=32 max=32 even=0 expect=valid
16028: pass str='DeafBeddedBabeAcceededFadedDecaff' min=32 max=32 even=0 expect=invalid
Harald Welte504caac2017-10-27 17:19:59 +0200161
162Testing BCD conversion
163 val=0x0, expected=0, found=0
164 val=0x1, expected=1, found=1
165 val=0x2, expected=2, found=2
166 val=0x3, expected=3, found=3
167 val=0x4, expected=4, found=4
168 val=0x5, expected=5, found=5
169 val=0x6, expected=6, found=6
170 val=0x7, expected=7, found=7
171 val=0x8, expected=8, found=8
172 val=0x9, expected=9, found=9
173 val=0xa, expected=A, found=A
174 val=0xb, expected=B, found=B
175 val=0xc, expected=C, found=C
176 val=0xd, expected=D, found=D
177 val=0xe, expected=E, found=E
178 val=0xf, expected=F, found=F
Neels Hofmeyr9910bbc2017-12-16 00:54:52 +0100179
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100180Testing bcd to string conversion
181- BCD-input='1a 32 54 76 98 f0' nibbles=[1..11[ str_size=64
182 rc=10
183 -> "1234567890"
184- BCD-input='1a 32 a4 cb 9d f0' nibbles=[1..11[ str_size=64
185 rc=-22
186 -> "1234ABCD90"
187- BCD-input='1a 32 a4 cb 9d f0' nibbles=[1..11[ str_size=64
188 rc=10
189 -> "1234ABCD90"
190- BCD-input='1a 32 54 76 98 f0' nibbles=[1..12[ str_size=64
191 rc=-22
192 -> "1234567890F"
193- BCD-input='1a 32 54 76 98 f0' nibbles=[1..12[ str_size=64
194 rc=11
195 -> "1234567890F"
196- BCD-input='1a 32 54 76 98 f0' nibbles=[0..12[ str_size=64
197 rc=12
198 -> "A1234567890F"
199- BCD-input='1a 32 54 76 98 f0' nibbles=[1..12[ str_size=5
200 rc=11
201 -> "1234"
202- BCD-input='' nibbles=[1..1[ str_size=64
203 rc=0
204 -> ""
205- zero output buffer
206 bcd2str(NULL, ...) -> -12
207 bcd2str(dst, 0, ...) -> -12
208
Neels Hofmeyr8a7eed52019-11-21 00:12:10 +0100209Testing string escaping: osmo_escape_str()
Neels Hofmeyr9910bbc2017-12-16 00:54:52 +0100210- all chars from 0 to 255 in batches of 16:
211"\0\1\2\3\4\5\6\a\b\t\n\v\f\r\14\15"
212"\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31"
213" !\"#$%&'()*+,-./"
214"0123456789:;<=>?"
215"@ABCDEFGHIJKLMNO"
216"PQRSTUVWXYZ[\\]^_"
217"`abcdefghijklmno"
218"pqrstuvwxyz{|}~\127"
219"\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143"
220"\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159"
221"\160\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175"
222"\176\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191"
223"\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207"
224"\208\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223"
225"\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239"
226"\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255"
227- nul terminated:
228"termi\nated"
229- passthru:
230passed through unchanged "printable"
231- zero length:
232""
233- truncation when too long:
234"\axxxxxxE"
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200235
Neels Hofmeyr8a7eed52019-11-21 00:12:10 +0100236Testing string quoting: osmo_quote_str()
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200237- all chars from 0 to 255 in batches of 16:
238'"\0\1\2\3\4\5\6\a\b\t\n\v\f\r\14\15"'
239'"\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31"'
240'" !\"#$%&'()*+,-./"'
241'"0123456789:;<=>?"'
242'"@ABCDEFGHIJKLMNO"'
243'"PQRSTUVWXYZ[\\]^_"'
244'"`abcdefghijklmno"'
245'"pqrstuvwxyz{|}~\127"'
246'"\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143"'
247'"\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159"'
248'"\160\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175"'
249'"\176\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191"'
250'"\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207"'
251'"\208\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223"'
252'"\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239"'
253'"\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255"'
254- nul terminated:
255'"termi\nated"'
256- never passthru:
257NOT passed through. '"printable"'
258- zero length:
259'""'
260- truncation when too long:
Neels Hofmeyrecef7ec2019-03-05 16:42:50 +0100261'"\axxxxxE'
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200262- always truncation, even when no escaping needed:
Neels Hofmeyrecef7ec2019-03-05 16:42:50 +0100263'"xxxxxxxE'
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200264- try to feed too little buf for quoting:
Neels Hofmeyrecef7ec2019-03-05 16:42:50 +0100265'"'
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200266- NULL string becomes a "NULL" literal:
267'NULL'
Harald Welte15a5f8d2018-06-06 16:58:17 +0200268
Neels Hofmeyr8a7eed52019-11-21 00:12:10 +0100269Testing string escaping: osmo_escape_cstr_buf()
270- all chars from 0 to 255 in batches of 16:
271"\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f"
272"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
273" !\"#$%&'()*+,-./"
274"0123456789:;<=>?"
275"@ABCDEFGHIJKLMNO"
276"PQRSTUVWXYZ[\\]^_"
277"`abcdefghijklmno"
278"pqrstuvwxyz{|}~\x7f"
279"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
280"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
281"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
282"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
283"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
284"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
285"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
286"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
287- nul terminated:
288"termi\nated"
289- passthru:
290passed through unchanged "printable"
291- zero length:
292""
293- truncation when too long:
294"\x07xxxxx"
295- Test escaping an escaped string:
2960: '\x02\x03\n'
2971: '\\x02\\x03\\n'
2982: '\\\\x02\\\\x03\\\\n'
2993: '\\\\\\\\x02\\\\\\\\x03\\\\\\\\n'
300
301Testing string quoting: osmo_quote_cstr_buf()
302- all chars from 0 to 255 in batches of 16:
303"\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f"
304"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
305" !\"#$%&'()*+,-./"
306"0123456789:;<=>?"
307"@ABCDEFGHIJKLMNO"
308"PQRSTUVWXYZ[\\]^_"
309"`abcdefghijklmno"
310"pqrstuvwxyz{|}~\x7f"
311"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
312"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
313"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
314"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
315"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
316"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
317"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
318"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
319- nul terminated:
320'"termi\nated"'
321- never passthru:
322NOT passed through. '"printable"'
323- zero length:
324'""'
325- truncation when too long:
326'"\x07xxxx'
327- always truncation, even when no escaping needed:
328'"xxxxxxxE'
329- try to feed too little buf for quoting:
330'"'
331- Test quoting a quoted+escaped string:
3320: "\x02\x03\n"
3331: "\"\\x02\\x03\\n\""
3342: "\"\\\"\\\\x02\\\\x03\\\\n\\\"\""
3353: "\"\\\"\\\\\\\"\\\\\\\\x02\\\\\\\\x03\\\\\\\\n\\\\\\\"\\\"\""
336- Test C-string equivalence:
337strcmp(OSMO_STRINGIFY_VAL(TEST_STR), osmo_quote_cstr_c(ctx, TEST_STR, 256)) == 0
338strcmp(OSMO_STRINGIFY_VAL(EMPTY_STR), osmo_quote_cstr_c(ctx, EMPTY_STR, -1)) == 0
339strcmp("NULL", osmo_quote_cstr_c(ctx, NULL, -1)) == 0
340
Harald Welte15a5f8d2018-06-06 16:58:17 +0200341Testing integer square-root
Neels Hofmeyr59f4caf2018-07-19 22:13:19 +0200342
343osmo_sockaddr_to_str_and_uint_test
344[0] 0.0.0.0:0 addr_len=20 --> 0.0.0.0:0 rc=7
345[1] 255.255.255.255:65535 addr_len=20 --> 255.255.255.255:65535 rc=15
346[2] 234.23.42.123:1234 addr_len=20 --> 234.23.42.123:1234 rc=13
347[3] 234.23.42.123:1234 addr_len=10 --> 234.23.42:1234 rc=13
348[4] 234.23.42.123:1234 (omit port) addr_len=20 --> 234.23.42.123:0 rc=13
349[5] 234.23.42.123:1234 (omit addr) addr_len=0 --> :1234 rc=0
350[6] 234.23.42.123:1234 addr_len=0 --> :1234 rc=13
351[7] 234.23.42.123:1234 (omit addr) (omit port) addr_len=0 --> :0 rc=0
Neels Hofmeyr7c749892018-09-07 03:01:38 +0200352
353osmo_str_tolowupper_test
354osmo_str_tolower("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
355 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
356osmo_str_toupper("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
357 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"
358osmo_str_tolower_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
359 = 62, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
360osmo_str_tolower_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
361 = 62, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
362osmo_str_toupper_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
363 = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"
364osmo_str_toupper_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
365 = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"
366osmo_str_tolower_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
367 = 62, "Unset"
368osmo_str_tolower_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
369 = 0, "Unset"
370osmo_str_toupper_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
371 = 62, "Unset"
372osmo_str_toupper_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
373 = 0, "Unset"
374osmo_str_tolower_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
375 = 62, ""
376osmo_str_tolower_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
377 = 0, ""
378osmo_str_toupper_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
379 = 62, ""
380osmo_str_toupper_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
381 = 0, ""
382osmo_str_tolower_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
383 = 62, "a"
384osmo_str_tolower_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
385 = 1, "a"
386osmo_str_toupper_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
387 = 62, "A"
388osmo_str_toupper_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
389 = 1, "A"
390osmo_str_tolower_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
391 = 62, "abcdefghijklmnopqrstuvwxyza"
392osmo_str_tolower_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
393 = 27, "abcdefghijklmnopqrstuvwxyza"
394osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
395 = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
396osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
397 = 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
Neels Hofmeyr2cbe25f2019-02-11 20:32:06 +0100398
399strbuf_test
400OSMO_STRBUF_APPEND():
401 The answer is 42
402would have needed 423470 bytes
403
404OSMO_STRBUF_PRINTF():
4051: (need 42 chars, had size=23) T minus 10 9 8 7 6 5 4
4062: (need 42 chars, had size=42) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off
4073: (need 42 chars, had size=42+1) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off!
4084: (need 42 chars, had size=0) 0x2b 0x2b 0x2b...
4095: (need 42 chars, had NULL buffer)
410
411cascade:
412(need 134 chars)
413T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off!
414(need 134 chars, had size=63) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7
Neels Hofmeyrd79ccc62019-03-07 23:08:40 +0100415
Neels Hofmeyr8531d662019-04-11 07:16:02 +0200416strbuf_test_nolen
41720: 0001011100101010 (need=16)
418more: 0001011100101010000 (need=19)
41910: 000101110 (need=9)
420
Neels Hofmeyrd79ccc62019-03-07 23:08:40 +0100421startswith_test()
422osmo_str_startswith(NULL, NULL) == true
423osmo_str_startswith("", NULL) == true
424osmo_str_startswith(NULL, "") == true
425osmo_str_startswith("", "") == true
426osmo_str_startswith("abc", NULL) == true
427osmo_str_startswith("abc", "") == true
428osmo_str_startswith(NULL, "abc") == false
429osmo_str_startswith("", "abc") == false
430osmo_str_startswith("abc", "a") == true
431osmo_str_startswith("abc", "ab") == true
432osmo_str_startswith("abc", "abc") == true
433osmo_str_startswith("abc", "abcd") == false
434osmo_str_startswith("abc", "xyz") == false
Neels Hofmeyr823073a2019-10-28 04:58:04 +0100435
436name_c_impl_test
437 0: "test"
438 OSMO_NAME_C_IMPL(10, "ERROR") -> "test" allocated 1 10 bytes, name 'foo_name_c'
439 OSMO_NAME_C_IMPL(10, NULL) -> "test" allocated 1 10 bytes, name 'foo_name_c_null'
440 OSMO_NAME_C_IMPL(0, "ERROR") -> "test" allocated 1 5 bytes, name 'foo_name_c_zero'
441 OSMO_NAME_C_IMPL(0, NULL) -> "test" allocated 1 5 bytes, name 'foo_name_c_zero_null'
442 1: "longer than 10 chars"
443 OSMO_NAME_C_IMPL(10, "ERROR") -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c'
444 OSMO_NAME_C_IMPL(10, NULL) -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c_null'
445 OSMO_NAME_C_IMPL(0, "ERROR") -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c_zero'
446 OSMO_NAME_C_IMPL(0, NULL) -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c_zero_null'
447 2: NULL
448 OSMO_NAME_C_IMPL(10, "ERROR") -> "ERROR" allocated 1 6 bytes, name 'foo_name_c'
449 OSMO_NAME_C_IMPL(10, NULL) -> NULL allocated 0
450 OSMO_NAME_C_IMPL(0, "ERROR") -> "ERROR" allocated 1 6 bytes, name 'foo_name_c_zero'
451 OSMO_NAME_C_IMPL(0, NULL) -> NULL allocated 0
Neels Hofmeyrff65d242019-11-19 00:21:14 +0100452
453osmo_print_n_test()
454"foo=bar" token_len=3 buf_size=100 -> token="foo" rc=3
455"foo" token_len=10 buf_size=100 -> token="foo" rc=3
456"foo" token_len=3 buf_size=100 -> token="foo" rc=3
457NULL token_len=10 buf_size=100 -> token="" rc=0
458"" token_len=10 buf_size=100 -> token="" rc=0
459"foo=bar" token_len=0 buf_size=100 -> token="" rc=0
460"foo=bar" token_len=3 buf_size=2 -> token="f" rc=3
461"foo" token_len=10 buf_size=2 -> token="f" rc=3
462"foo" token_len=3 buf_size=2 -> token="f" rc=3
463NULL token_len=10 buf_size=2 -> token="" rc=0
464"" token_len=10 buf_size=2 -> token="" rc=0
465"foo=bar" token_len=0 buf_size=2 -> token="" rc=0
466"foo=bar" token_len=3 buf_size=1 -> token="" rc=3
467"foo" token_len=10 buf_size=1 -> token="" rc=3
468"foo" token_len=3 buf_size=1 -> token="" rc=3
469NULL token_len=10 buf_size=1 -> token="" rc=0
470"" token_len=10 buf_size=1 -> token="" rc=0
471"foo=bar" token_len=0 buf_size=1 -> token="" rc=0
472"foo=bar" token_len=3 buf_size=0 -> token="unchanged" rc=3
473"foo" token_len=10 buf_size=0 -> token="unchanged" rc=3
474"foo" token_len=3 buf_size=0 -> token="unchanged" rc=3
475NULL token_len=10 buf_size=0 -> token="unchanged" rc=0
476"" token_len=10 buf_size=0 -> token="unchanged" rc=0
477"foo=bar" token_len=0 buf_size=0 -> token="unchanged" rc=0
Neels Hofmeyr06356fd2019-11-19 01:38:10 +0100478
479osmo_strnchr_test()
480osmo_strnchr("foo=bar", 8, '=') -> 3
481osmo_strnchr("foo=bar", 4, '=') -> 3
482osmo_strnchr("foo=bar", 3, '=') -> -1
483osmo_strnchr("foo=bar", 0, '=') -> -1
484osmo_strnchr("foo", 9, '=') -> -1
485osmo_strnchr("foo", 9, '\0') -> 3