blob: 8a66ba81d6e15e53fd3177f64c6c56d5d6c2e4ac [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"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200184osmo_str2bcd(start_nibble=1) -> rc=6
185 = 1f 32 54 76 98 f0
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100186- BCD-input='1a 32 a4 cb 9d f0' nibbles=[1..11[ str_size=64
187 rc=-22
188 -> "1234ABCD90"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200189osmo_str2bcd(start_nibble=1) -> rc=-22
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100190- BCD-input='1a 32 a4 cb 9d f0' nibbles=[1..11[ str_size=64
191 rc=10
192 -> "1234ABCD90"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200193osmo_str2bcd(start_nibble=1) -> rc=6
194 = 1f 32 a4 cb 9d f0
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100195- BCD-input='1a 32 54 76 98 f0' nibbles=[1..12[ str_size=64
196 rc=-22
197 -> "1234567890F"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200198osmo_str2bcd(start_nibble=1) -> rc=-22
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100199- BCD-input='1a 32 54 76 98 f0' nibbles=[1..12[ str_size=64
200 rc=11
201 -> "1234567890F"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200202osmo_str2bcd(start_nibble=1) -> rc=6
203 = 1f 32 54 76 98 f0
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100204- BCD-input='1a 32 54 76 98 f0' nibbles=[0..12[ str_size=64
205 rc=12
206 -> "A1234567890F"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200207osmo_str2bcd(start_nibble=0) -> rc=6
208 = 1a 32 54 76 98 f0
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100209- BCD-input='1a 32 54 76 98 f0' nibbles=[1..12[ str_size=5
210 rc=11
211 -> "1234"
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200212osmo_str2bcd(start_nibble=1) -> rc=3
213 = 1f 32 f4
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100214- BCD-input='' nibbles=[1..1[ str_size=64
215 rc=0
216 -> ""
Neels Hofmeyr83025bf2020-05-26 02:45:23 +0200217osmo_str2bcd(start_nibble=1) -> rc=1
218 = ff
Neels Hofmeyr7079e692018-12-05 21:02:36 +0100219- zero output buffer
220 bcd2str(NULL, ...) -> -12
221 bcd2str(dst, 0, ...) -> -12
222
Neels Hofmeyr8a7eed52019-11-21 00:12:10 +0100223Testing string escaping: osmo_escape_str()
Neels Hofmeyr9910bbc2017-12-16 00:54:52 +0100224- all chars from 0 to 255 in batches of 16:
225"\0\1\2\3\4\5\6\a\b\t\n\v\f\r\14\15"
226"\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31"
227" !\"#$%&'()*+,-./"
228"0123456789:;<=>?"
229"@ABCDEFGHIJKLMNO"
230"PQRSTUVWXYZ[\\]^_"
231"`abcdefghijklmno"
232"pqrstuvwxyz{|}~\127"
233"\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143"
234"\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159"
235"\160\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175"
236"\176\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191"
237"\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207"
238"\208\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223"
239"\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239"
240"\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255"
241- nul terminated:
242"termi\nated"
243- passthru:
244passed through unchanged "printable"
245- zero length:
246""
247- truncation when too long:
248"\axxxxxxE"
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200249
Neels Hofmeyr8a7eed52019-11-21 00:12:10 +0100250Testing string quoting: osmo_quote_str()
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200251- all chars from 0 to 255 in batches of 16:
252'"\0\1\2\3\4\5\6\a\b\t\n\v\f\r\14\15"'
253'"\16\17\18\19\20\21\22\23\24\25\26\27\28\29\30\31"'
254'" !\"#$%&'()*+,-./"'
255'"0123456789:;<=>?"'
256'"@ABCDEFGHIJKLMNO"'
257'"PQRSTUVWXYZ[\\]^_"'
258'"`abcdefghijklmno"'
259'"pqrstuvwxyz{|}~\127"'
260'"\128\129\130\131\132\133\134\135\136\137\138\139\140\141\142\143"'
261'"\144\145\146\147\148\149\150\151\152\153\154\155\156\157\158\159"'
262'"\160\161\162\163\164\165\166\167\168\169\170\171\172\173\174\175"'
263'"\176\177\178\179\180\181\182\183\184\185\186\187\188\189\190\191"'
264'"\192\193\194\195\196\197\198\199\200\201\202\203\204\205\206\207"'
265'"\208\209\210\211\212\213\214\215\216\217\218\219\220\221\222\223"'
266'"\224\225\226\227\228\229\230\231\232\233\234\235\236\237\238\239"'
267'"\240\241\242\243\244\245\246\247\248\249\250\251\252\253\254\255"'
268- nul terminated:
269'"termi\nated"'
270- never passthru:
271NOT passed through. '"printable"'
272- zero length:
273'""'
274- truncation when too long:
Neels Hofmeyrecef7ec2019-03-05 16:42:50 +0100275'"\axxxxxE'
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200276- always truncation, even when no escaping needed:
Neels Hofmeyrecef7ec2019-03-05 16:42:50 +0100277'"xxxxxxxE'
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200278- try to feed too little buf for quoting:
Neels Hofmeyrecef7ec2019-03-05 16:42:50 +0100279'"'
Neels Hofmeyr04eb56f2018-04-09 00:41:28 +0200280- NULL string becomes a "NULL" literal:
281'NULL'
Harald Welte15a5f8d2018-06-06 16:58:17 +0200282
Neels Hofmeyr8a7eed52019-11-21 00:12:10 +0100283Testing string escaping: osmo_escape_cstr_buf()
284- all chars from 0 to 255 in batches of 16:
285"\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f"
286"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
287" !\"#$%&'()*+,-./"
288"0123456789:;<=>?"
289"@ABCDEFGHIJKLMNO"
290"PQRSTUVWXYZ[\\]^_"
291"`abcdefghijklmno"
292"pqrstuvwxyz{|}~\x7f"
293"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
294"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
295"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
296"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
297"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
298"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
299"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
300"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
301- nul terminated:
302"termi\nated"
303- passthru:
304passed through unchanged "printable"
305- zero length:
306""
307- truncation when too long:
308"\x07xxxxx"
309- Test escaping an escaped string:
3100: '\x02\x03\n'
3111: '\\x02\\x03\\n'
3122: '\\\\x02\\\\x03\\\\n'
3133: '\\\\\\\\x02\\\\\\\\x03\\\\\\\\n'
314
315Testing string quoting: osmo_quote_cstr_buf()
316- all chars from 0 to 255 in batches of 16:
317"\0\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f"
318"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"
319" !\"#$%&'()*+,-./"
320"0123456789:;<=>?"
321"@ABCDEFGHIJKLMNO"
322"PQRSTUVWXYZ[\\]^_"
323"`abcdefghijklmno"
324"pqrstuvwxyz{|}~\x7f"
325"\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"
326"\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f"
327"\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf"
328"\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf"
329"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf"
330"\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf"
331"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef"
332"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
333- nul terminated:
334'"termi\nated"'
335- never passthru:
336NOT passed through. '"printable"'
337- zero length:
338'""'
339- truncation when too long:
340'"\x07xxxx'
341- always truncation, even when no escaping needed:
342'"xxxxxxxE'
343- try to feed too little buf for quoting:
344'"'
345- Test quoting a quoted+escaped string:
3460: "\x02\x03\n"
3471: "\"\\x02\\x03\\n\""
3482: "\"\\\"\\\\x02\\\\x03\\\\n\\\"\""
3493: "\"\\\"\\\\\\\"\\\\\\\\x02\\\\\\\\x03\\\\\\\\n\\\\\\\"\\\"\""
350- Test C-string equivalence:
351strcmp(OSMO_STRINGIFY_VAL(TEST_STR), osmo_quote_cstr_c(ctx, TEST_STR, 256)) == 0
352strcmp(OSMO_STRINGIFY_VAL(EMPTY_STR), osmo_quote_cstr_c(ctx, EMPTY_STR, -1)) == 0
353strcmp("NULL", osmo_quote_cstr_c(ctx, NULL, -1)) == 0
354
Harald Welte15a5f8d2018-06-06 16:58:17 +0200355Testing integer square-root
Neels Hofmeyr59f4caf2018-07-19 22:13:19 +0200356
Philipp Maier94705d02023-01-11 10:55:47 +0100357Testing built in truncated modulo for comparison:
358 8 mod 3 = 2 = 2
359 8 mod -3 = 2 = 2
360 -8 mod 3 = -2 = -2
361 -8 mod -3 = -2 = -2
362 1 mod 2 = 1 = 1
363 1 mod -2 = 1 = 1
364 -1 mod 2 = -1 = -1
365 -1 mod -2 = -1 = -1
366
367Testing OSMO_MOD_FLR():
368 8 mod_flr 3 = 2 = 2
369 8 mod_flr -3 = -1 = -1
370 -8 mod_flr 3 = 1 = 1
371 -8 mod_flr -3 = -2 = -2
372 1 mod_flr 2 = 1 = 1
373 1 mod_flr -2 = -1 = -1
374 -1 mod_flr 2 = 1 = 1
375 -1 mod_flr -2 = -1 = -1
376
377Testing OSMO_MOD_EUC():
378 8 mod_euc 3 = 2 = 2
379 8 mod_euc -3 = 2 = 2
380 -8 mod_euc 3 = 1 = 1
381 -8 mod_euc -3 = 1 = 1
382 1 mod_euc 2 = 1 = 1
383 1 mod_euc -2 = 1 = 1
384 -1 mod_euc 2 = 1 = 1
385 -1 mod_euc -2 = 1 = 1
386
Neels Hofmeyr59f4caf2018-07-19 22:13:19 +0200387osmo_sockaddr_to_str_and_uint_test
Pau Espin Pedrol1a3d24e2020-08-28 18:31:32 +0200388[0] [0.0.0.0]:0 addr_len=20 --> [0.0.0.0]:0 rc=7
389[1] [255.255.255.255]:65535 addr_len=20 --> [255.255.255.255]:65535 rc=15
390[2] [234.23.42.123]:1234 addr_len=20 --> [234.23.42.123]:1234 rc=13
391[3] [234.23.42.123]:1234 addr_len=10 --> [234.23.42]:1234 rc=13
392[4] [234.23.42.123]:1234 (omit port) addr_len=20 --> [234.23.42.123]:0 rc=13
393[5] [234.23.42.123]:1234 (omit addr) addr_len=0 --> []:1234 rc=0
394[6] [234.23.42.123]:1234 addr_len=0 --> []:1234 rc=13
395[7] [234.23.42.123]:1234 (omit addr) (omit port) addr_len=0 --> []:0 rc=0
396[8] [::]:1234 addr_len=20 --> [::]:1234 rc=2
397[9] [::1]:1234 addr_len=20 --> [::1]:1234 rc=3
398[10] [::1]:1234 (omit port) addr_len=20 --> [::1]:0 rc=3
399[11] [::1]:1234 (omit addr) addr_len=20 --> []:1234 rc=0
400[12] [fd02:db8:1::1]:1234 addr_len=20 --> [fd02:db8:1::1]:1234 rc=13
401[13] [2001:db8:1::ab9:C0A8:102]:1234 addr_len=40 --> [2001:db8:1::ab9:c0a8:102]:1234 rc=24
402[14] [2001:0db8:0001:0000:0000:0ab9:C0A8:0102]:1234 addr_len=32 --> [2001:db8:1::ab9:c0a8:102]:1234 rc=24
403[15] [::ffff:192.168.20.34]:1234 addr_len=32 --> [::ffff:192.168.20.34]:1234 rc=20
Neels Hofmeyr7c749892018-09-07 03:01:38 +0200404
405osmo_str_tolowupper_test
406osmo_str_tolower("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
407 = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
408osmo_str_toupper("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
409 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"
410osmo_str_tolower_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
411 = 62, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
412osmo_str_tolower_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
413 = 62, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz!@#$%^&*()"
414osmo_str_toupper_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
415 = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"
416osmo_str_toupper_buf(99, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
417 = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"
418osmo_str_tolower_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
419 = 62, "Unset"
420osmo_str_tolower_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
421 = 0, "Unset"
422osmo_str_toupper_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
423 = 62, "Unset"
424osmo_str_toupper_buf(0, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
425 = 0, "Unset"
426osmo_str_tolower_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
427 = 62, ""
428osmo_str_tolower_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
429 = 0, ""
430osmo_str_toupper_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
431 = 62, ""
432osmo_str_toupper_buf(1, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
433 = 0, ""
434osmo_str_tolower_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
435 = 62, "a"
436osmo_str_tolower_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
437 = 1, "a"
438osmo_str_toupper_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
439 = 62, "A"
440osmo_str_toupper_buf(2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
441 = 1, "A"
442osmo_str_tolower_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
443 = 62, "abcdefghijklmnopqrstuvwxyza"
444osmo_str_tolower_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
445 = 27, "abcdefghijklmnopqrstuvwxyza"
446osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()")
447 = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
448osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
449 = 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
Neels Hofmeyr2cbe25f2019-02-11 20:32:06 +0100450
451strbuf_test
452OSMO_STRBUF_APPEND():
453 The answer is 42
454would have needed 423470 bytes
455
456OSMO_STRBUF_PRINTF():
4571: (need 42 chars, had size=23) T minus 10 9 8 7 6 5 4
4582: (need 42 chars, had size=42) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off
4593: (need 42 chars, had size=42+1) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off!
4604: (need 42 chars, had size=0) 0x2b 0x2b 0x2b...
Neels Hofmeyr2cbe25f2019-02-11 20:32:06 +0100461
462cascade:
463(need 134 chars)
464T 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!
465(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 +0100466
Neels Hofmeyr8531d662019-04-11 07:16:02 +0200467strbuf_test_nolen
46820: 0001011100101010 (need=16)
469more: 0001011100101010000 (need=19)
47010: 000101110 (need=9)
471
Neels Hofmeyrd511a9d2023-12-04 07:48:55 +0100472strbuf_test_tail_for_buflen(64)
4731: "banananana\n" sb.chars_needed=11 sb.pos=&sb.buf[11]
4742: "bananana" sb.chars_needed=8 sb.pos=&sb.buf[8]
4753: "bananana\n" sb.chars_needed=9 sb.pos=&sb.buf[9]
4764: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
4775: "banana\n" sb.chars_needed=7 sb.pos=&sb.buf[7]
4786: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
4797: "bananabread\n" sb.chars_needed=12 sb.pos=&sb.buf[12]
480
481strbuf_test_tail_for_buflen(32)
4821: "banananana\n" sb.chars_needed=11 sb.pos=&sb.buf[11]
4832: "bananana" sb.chars_needed=8 sb.pos=&sb.buf[8]
4843: "bananana\n" sb.chars_needed=9 sb.pos=&sb.buf[9]
4854: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
4865: "banana\n" sb.chars_needed=7 sb.pos=&sb.buf[7]
4876: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
4887: "bananabread\n" sb.chars_needed=12 sb.pos=&sb.buf[12]
489
490strbuf_test_tail_for_buflen(16)
4911: "banananana\n" sb.chars_needed=11 sb.pos=&sb.buf[11]
4922: "bananana" sb.chars_needed=8 sb.pos=&sb.buf[8]
4933: "bananana\n" sb.chars_needed=9 sb.pos=&sb.buf[9]
4944: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
4955: "banana\n" sb.chars_needed=7 sb.pos=&sb.buf[7]
4966: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
4977: "bananabread\n" sb.chars_needed=12 sb.pos=&sb.buf[12]
498
499strbuf_test_tail_for_buflen(8)
5001: "bananan" sb.chars_needed=11 sb.pos=&sb.buf[8]
5012: "bananan" sb.chars_needed=8 sb.pos=&sb.buf[8]
5023: "bananan" sb.chars_needed=9 sb.pos=&sb.buf[8]
5034: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
5045: "banana\n" sb.chars_needed=7 sb.pos=&sb.buf[7]
5056: "banana" sb.chars_needed=6 sb.pos=&sb.buf[6]
5067: "bananab" sb.chars_needed=12 sb.pos=&sb.buf[7]
507
508strbuf_test_tail_for_buflen(4)
5091: "ban" sb.chars_needed=11 sb.pos=&sb.buf[4]
5102: "ban" sb.chars_needed=8 sb.pos=&sb.buf[4]
5113: "ban" sb.chars_needed=9 sb.pos=&sb.buf[4]
5124: "ban" sb.chars_needed=6 sb.pos=&sb.buf[4]
5135: "ban" sb.chars_needed=7 sb.pos=&sb.buf[4]
5146: "ban" sb.chars_needed=6 sb.pos=&sb.buf[4]
5157: "ban" sb.chars_needed=12 sb.pos=&sb.buf[4]
516
517strbuf_test_tail_for_buflen(1)
5181: "" sb.chars_needed=11 sb.pos=&sb.buf[1]
5192: "" sb.chars_needed=8 sb.pos=&sb.buf[1]
5203: "" sb.chars_needed=9 sb.pos=&sb.buf[1]
5214: "" sb.chars_needed=6 sb.pos=&sb.buf[1]
5225: "" sb.chars_needed=7 sb.pos=&sb.buf[1]
5236: "" sb.chars_needed=6 sb.pos=&sb.buf[1]
5247: "" sb.chars_needed=12 sb.pos=&sb.buf[1]
525
Vadim Yanitskiy9df820b2023-12-11 13:34:02 +0700526strbuf_test_remain_char_count
527remaining space: 20
528current char count: 0
529populating the buffer
530remaining space: 13
531current char count: 7
532
Neels Hofmeyrd79ccc62019-03-07 23:08:40 +0100533startswith_test()
534osmo_str_startswith(NULL, NULL) == true
535osmo_str_startswith("", NULL) == true
536osmo_str_startswith(NULL, "") == true
537osmo_str_startswith("", "") == true
538osmo_str_startswith("abc", NULL) == true
539osmo_str_startswith("abc", "") == true
540osmo_str_startswith(NULL, "abc") == false
541osmo_str_startswith("", "abc") == false
542osmo_str_startswith("abc", "a") == true
543osmo_str_startswith("abc", "ab") == true
544osmo_str_startswith("abc", "abc") == true
545osmo_str_startswith("abc", "abcd") == false
546osmo_str_startswith("abc", "xyz") == false
Neels Hofmeyr823073a2019-10-28 04:58:04 +0100547
548name_c_impl_test
549 0: "test"
550 OSMO_NAME_C_IMPL(10, "ERROR") -> "test" allocated 1 10 bytes, name 'foo_name_c'
551 OSMO_NAME_C_IMPL(10, NULL) -> "test" allocated 1 10 bytes, name 'foo_name_c_null'
552 OSMO_NAME_C_IMPL(0, "ERROR") -> "test" allocated 1 5 bytes, name 'foo_name_c_zero'
553 OSMO_NAME_C_IMPL(0, NULL) -> "test" allocated 1 5 bytes, name 'foo_name_c_zero_null'
554 1: "longer than 10 chars"
555 OSMO_NAME_C_IMPL(10, "ERROR") -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c'
556 OSMO_NAME_C_IMPL(10, NULL) -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c_null'
557 OSMO_NAME_C_IMPL(0, "ERROR") -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c_zero'
558 OSMO_NAME_C_IMPL(0, NULL) -> "longer than 10 chars" allocated 1 21 bytes, name 'foo_name_c_zero_null'
559 2: NULL
560 OSMO_NAME_C_IMPL(10, "ERROR") -> "ERROR" allocated 1 6 bytes, name 'foo_name_c'
561 OSMO_NAME_C_IMPL(10, NULL) -> NULL allocated 0
562 OSMO_NAME_C_IMPL(0, "ERROR") -> "ERROR" allocated 1 6 bytes, name 'foo_name_c_zero'
563 OSMO_NAME_C_IMPL(0, NULL) -> NULL allocated 0
Neels Hofmeyrff65d242019-11-19 00:21:14 +0100564
565osmo_print_n_test()
566"foo=bar" token_len=3 buf_size=100 -> token="foo" rc=3
567"foo" token_len=10 buf_size=100 -> token="foo" rc=3
568"foo" token_len=3 buf_size=100 -> token="foo" rc=3
569NULL token_len=10 buf_size=100 -> token="" rc=0
570"" token_len=10 buf_size=100 -> token="" rc=0
571"foo=bar" token_len=0 buf_size=100 -> token="" rc=0
572"foo=bar" token_len=3 buf_size=2 -> token="f" rc=3
573"foo" token_len=10 buf_size=2 -> token="f" rc=3
574"foo" token_len=3 buf_size=2 -> token="f" rc=3
575NULL token_len=10 buf_size=2 -> token="" rc=0
576"" token_len=10 buf_size=2 -> token="" rc=0
577"foo=bar" token_len=0 buf_size=2 -> token="" rc=0
578"foo=bar" token_len=3 buf_size=1 -> token="" rc=3
579"foo" token_len=10 buf_size=1 -> token="" rc=3
580"foo" token_len=3 buf_size=1 -> token="" rc=3
581NULL token_len=10 buf_size=1 -> token="" rc=0
582"" token_len=10 buf_size=1 -> token="" rc=0
583"foo=bar" token_len=0 buf_size=1 -> token="" rc=0
584"foo=bar" token_len=3 buf_size=0 -> token="unchanged" rc=3
585"foo" token_len=10 buf_size=0 -> token="unchanged" rc=3
586"foo" token_len=3 buf_size=0 -> token="unchanged" rc=3
587NULL token_len=10 buf_size=0 -> token="unchanged" rc=0
588"" token_len=10 buf_size=0 -> token="unchanged" rc=0
589"foo=bar" token_len=0 buf_size=0 -> token="unchanged" rc=0
Neels Hofmeyr06356fd2019-11-19 01:38:10 +0100590
591osmo_strnchr_test()
592osmo_strnchr("foo=bar", 8, '=') -> 3
593osmo_strnchr("foo=bar", 4, '=') -> 3
594osmo_strnchr("foo=bar", 3, '=') -> -1
595osmo_strnchr("foo=bar", 0, '=') -> -1
596osmo_strnchr("foo", 9, '=') -> -1
597osmo_strnchr("foo", 9, '\0') -> 3
Neels Hofmeyr87c3afb2020-09-30 21:47:47 +0000598--- test_float_str_to_int
599osmo_float_str_to_int("0", 0) -> rc=0 val=0
600osmo_float_str_to_int("1", 0) -> rc=0 val=1
601osmo_float_str_to_int("12.345", 0) -> rc=0 val=12
602osmo_float_str_to_int("+12.345", 0) -> rc=0 val=12
603osmo_float_str_to_int("-12.345", 0) -> rc=0 val=-12
604osmo_float_str_to_int("0.345", 0) -> rc=0 val=0
605osmo_float_str_to_int(".345", 0) -> rc=0 val=0
606osmo_float_str_to_int("-0.345", 0) -> rc=0 val=0
607osmo_float_str_to_int("-.345", 0) -> rc=0 val=0
608osmo_float_str_to_int("12.", 0) -> rc=0 val=12
609osmo_float_str_to_int("-180", 0) -> rc=0 val=-180
610osmo_float_str_to_int("180", 0) -> rc=0 val=180
611osmo_float_str_to_int("360", 0) -> rc=0 val=360
612osmo_float_str_to_int("123.4567890123", 0) -> rc=0 val=123
613osmo_float_str_to_int("123.4567890123456789012345", 0) -> rc=0 val=123
614osmo_float_str_to_int("9223372036854775807", 0) -> rc=0 val=9223372036854775807
615osmo_float_str_to_int("-9223372036854775807", 0) -> rc=0 val=-9223372036854775807
616osmo_float_str_to_int("-9223372036854775808", 0) -> rc=-34=-ERANGE val=0
617osmo_float_str_to_int("9223372036854775808", 0) -> rc=-34=-ERANGE val=0
618osmo_float_str_to_int("-9223372036854775809", 0) -> rc=-34=-ERANGE val=0
619osmo_float_str_to_int("100000000000000000000", 0) -> rc=-34=-ERANGE val=0
620osmo_float_str_to_int("-100000000000000000000", 0) -> rc=-34=-ERANGE val=0
621osmo_float_str_to_int("999999999999999999999999999.99", 0) -> rc=-34=-ERANGE val=0
622osmo_float_str_to_int("-999999999999999999999999999.99", 0) -> rc=-34=-ERANGE val=0
623osmo_float_str_to_int("1.2.3", 0) -> rc=-22=-EINVAL val=0
624osmo_float_str_to_int("foo", 0) -> rc=-22=-EINVAL val=0
625osmo_float_str_to_int("1.foo", 0) -> rc=-22=-EINVAL val=0
626osmo_float_str_to_int("1.foo", 0) -> rc=-22=-EINVAL val=0
627osmo_float_str_to_int("12.-345", 0) -> rc=-22=-EINVAL val=0
628osmo_float_str_to_int("-12.-345", 0) -> rc=-22=-EINVAL val=0
629osmo_float_str_to_int("12.+345", 0) -> rc=-22=-EINVAL val=0
630osmo_float_str_to_int("+12.+345", 0) -> rc=-22=-EINVAL val=0
631osmo_float_str_to_int("", 0) -> rc=-22=-EINVAL val=0
632osmo_float_str_to_int(NULL, 0) -> rc=-22=-EINVAL val=0
633osmo_float_str_to_int("0", 1) -> rc=0 val=0
634osmo_float_str_to_int("1", 1) -> rc=0 val=10
635osmo_float_str_to_int("12.345", 1) -> rc=0 val=123
636osmo_float_str_to_int("+12.345", 1) -> rc=0 val=123
637osmo_float_str_to_int("-12.345", 1) -> rc=0 val=-123
638osmo_float_str_to_int("0.345", 1) -> rc=0 val=3
639osmo_float_str_to_int(".345", 1) -> rc=0 val=3
640osmo_float_str_to_int("-0.345", 1) -> rc=0 val=-3
641osmo_float_str_to_int("-.345", 1) -> rc=0 val=-3
642osmo_float_str_to_int("12.", 1) -> rc=0 val=120
643osmo_float_str_to_int("-180", 1) -> rc=0 val=-1800
644osmo_float_str_to_int("180", 1) -> rc=0 val=1800
645osmo_float_str_to_int("360", 1) -> rc=0 val=3600
646osmo_float_str_to_int("123.4567890123", 1) -> rc=0 val=1234
647osmo_float_str_to_int("123.4567890123456789012345", 1) -> rc=0 val=1234
648osmo_float_str_to_int("922337203685477580.7", 1) -> rc=0 val=9223372036854775807
649osmo_float_str_to_int("-922337203685477580.7", 1) -> rc=0 val=-9223372036854775807
650osmo_float_str_to_int("-922337203685477580.8", 1) -> rc=-34=-ERANGE val=0
651osmo_float_str_to_int("922337203685477580.8", 1) -> rc=-34=-ERANGE val=0
652osmo_float_str_to_int("-922337203685477580.9", 1) -> rc=-34=-ERANGE val=0
653osmo_float_str_to_int("100000000000000000000", 1) -> rc=-34=-ERANGE val=0
654osmo_float_str_to_int("-100000000000000000000", 1) -> rc=-34=-ERANGE val=0
655osmo_float_str_to_int("999999999999999999999999999.99", 1) -> rc=-34=-ERANGE val=0
656osmo_float_str_to_int("-999999999999999999999999999.99", 1) -> rc=-34=-ERANGE val=0
657osmo_float_str_to_int("1.2.3", 1) -> rc=-22=-EINVAL val=0
658osmo_float_str_to_int("foo", 1) -> rc=-22=-EINVAL val=0
659osmo_float_str_to_int("1.foo", 1) -> rc=-22=-EINVAL val=0
660osmo_float_str_to_int("1.foo", 1) -> rc=-22=-EINVAL val=0
661osmo_float_str_to_int("12.-345", 1) -> rc=-22=-EINVAL val=0
662osmo_float_str_to_int("-12.-345", 1) -> rc=-22=-EINVAL val=0
663osmo_float_str_to_int("12.+345", 1) -> rc=-22=-EINVAL val=0
664osmo_float_str_to_int("+12.+345", 1) -> rc=-22=-EINVAL val=0
665osmo_float_str_to_int("", 1) -> rc=-22=-EINVAL val=0
666osmo_float_str_to_int(NULL, 1) -> rc=-22=-EINVAL val=0
667osmo_float_str_to_int("0", 6) -> rc=0 val=0
668osmo_float_str_to_int("1", 6) -> rc=0 val=1000000
669osmo_float_str_to_int("12.345", 6) -> rc=0 val=12345000
670osmo_float_str_to_int("+12.345", 6) -> rc=0 val=12345000
671osmo_float_str_to_int("-12.345", 6) -> rc=0 val=-12345000
672osmo_float_str_to_int("0.345", 6) -> rc=0 val=345000
673osmo_float_str_to_int(".345", 6) -> rc=0 val=345000
674osmo_float_str_to_int("-0.345", 6) -> rc=0 val=-345000
675osmo_float_str_to_int("-.345", 6) -> rc=0 val=-345000
676osmo_float_str_to_int("12.", 6) -> rc=0 val=12000000
677osmo_float_str_to_int("-180", 6) -> rc=0 val=-180000000
678osmo_float_str_to_int("180", 6) -> rc=0 val=180000000
679osmo_float_str_to_int("360", 6) -> rc=0 val=360000000
680osmo_float_str_to_int("123.4567890123", 6) -> rc=0 val=123456789
681osmo_float_str_to_int("123.4567890123456789012345", 6) -> rc=0 val=123456789
682osmo_float_str_to_int("9223372036854.775807", 6) -> rc=0 val=9223372036854775807
683osmo_float_str_to_int("-9223372036854.775807", 6) -> rc=0 val=-9223372036854775807
684osmo_float_str_to_int("-9223372036854.775808", 6) -> rc=-34=-ERANGE val=0
685osmo_float_str_to_int("9223372036854.775808", 6) -> rc=-34=-ERANGE val=0
686osmo_float_str_to_int("-9223372036854.775809", 6) -> rc=-34=-ERANGE val=0
687osmo_float_str_to_int("100000000000000000000", 6) -> rc=-34=-ERANGE val=0
688osmo_float_str_to_int("-100000000000000000000", 6) -> rc=-34=-ERANGE val=0
689osmo_float_str_to_int("999999999999999999999999999.99", 6) -> rc=-34=-ERANGE val=0
690osmo_float_str_to_int("-999999999999999999999999999.99", 6) -> rc=-34=-ERANGE val=0
691osmo_float_str_to_int("1.2.3", 6) -> rc=-22=-EINVAL val=0
692osmo_float_str_to_int("foo", 6) -> rc=-22=-EINVAL val=0
693osmo_float_str_to_int("1.foo", 6) -> rc=-22=-EINVAL val=0
694osmo_float_str_to_int("1.foo", 6) -> rc=-22=-EINVAL val=0
695osmo_float_str_to_int("12.-345", 6) -> rc=-22=-EINVAL val=0
696osmo_float_str_to_int("-12.-345", 6) -> rc=-22=-EINVAL val=0
697osmo_float_str_to_int("12.+345", 6) -> rc=-22=-EINVAL val=0
698osmo_float_str_to_int("+12.+345", 6) -> rc=-22=-EINVAL val=0
699osmo_float_str_to_int("", 6) -> rc=-22=-EINVAL val=0
700osmo_float_str_to_int(NULL, 6) -> rc=-22=-EINVAL val=0
701osmo_float_str_to_int("0", 18) -> rc=0 val=0
702osmo_float_str_to_int("1", 18) -> rc=0 val=1000000000000000000
703osmo_float_str_to_int("1.2345", 18) -> rc=0 val=1234500000000000000
704osmo_float_str_to_int("+1.2345", 18) -> rc=0 val=1234500000000000000
705osmo_float_str_to_int("-1.2345", 18) -> rc=0 val=-1234500000000000000
706osmo_float_str_to_int("0.345", 18) -> rc=0 val=345000000000000000
707osmo_float_str_to_int(".345", 18) -> rc=0 val=345000000000000000
708osmo_float_str_to_int("-0.345", 18) -> rc=0 val=-345000000000000000
709osmo_float_str_to_int("-.345", 18) -> rc=0 val=-345000000000000000
710osmo_float_str_to_int("2.", 18) -> rc=0 val=2000000000000000000
711osmo_float_str_to_int("-8", 18) -> rc=0 val=-8000000000000000000
712osmo_float_str_to_int("1.234567890123", 18) -> rc=0 val=1234567890123000000
713osmo_float_str_to_int("1.234567890123456789012345", 18) -> rc=0 val=1234567890123456789
714osmo_float_str_to_int("123.4567890123", 18) -> rc=-34=-ERANGE val=0
715osmo_float_str_to_int("9.223372036854775807", 18) -> rc=0 val=9223372036854775807
716osmo_float_str_to_int("-9.223372036854775807", 18) -> rc=0 val=-9223372036854775807
717osmo_float_str_to_int("-9.223372036854775808", 18) -> rc=-34=-ERANGE val=0
718osmo_float_str_to_int("9.223372036854775808", 18) -> rc=-34=-ERANGE val=0
719osmo_float_str_to_int("-9.223372036854775809", 18) -> rc=-34=-ERANGE val=0
720osmo_float_str_to_int("100000000000000000000", 18) -> rc=-34=-ERANGE val=0
721osmo_float_str_to_int("-100000000000000000000", 18) -> rc=-34=-ERANGE val=0
722osmo_float_str_to_int("999999999999999999999999999.99", 18) -> rc=-34=-ERANGE val=0
723osmo_float_str_to_int("-999999999999999999999999999.99", 18) -> rc=-34=-ERANGE val=0
724osmo_float_str_to_int("1.2.3", 18) -> rc=-22=-EINVAL val=0
725osmo_float_str_to_int("foo", 18) -> rc=-22=-EINVAL val=0
726osmo_float_str_to_int("1.foo", 18) -> rc=-22=-EINVAL val=0
727osmo_float_str_to_int("1.foo", 18) -> rc=-22=-EINVAL val=0
728osmo_float_str_to_int("12.-345", 18) -> rc=-22=-EINVAL val=0
729osmo_float_str_to_int("-12.-345", 18) -> rc=-22=-EINVAL val=0
730osmo_float_str_to_int("12.+345", 18) -> rc=-22=-EINVAL val=0
731osmo_float_str_to_int("+12.+345", 18) -> rc=-22=-EINVAL val=0
732osmo_float_str_to_int("", 18) -> rc=-22=-EINVAL val=0
733osmo_float_str_to_int(NULL, 18) -> rc=-22=-EINVAL val=0
734osmo_float_str_to_int("0", 19) -> rc=0 val=0
735osmo_float_str_to_int(".1", 19) -> rc=0 val=1000000000000000000
736osmo_float_str_to_int(".12345", 19) -> rc=0 val=1234500000000000000
737osmo_float_str_to_int("+.12345", 19) -> rc=0 val=1234500000000000000
738osmo_float_str_to_int("-.12345", 19) -> rc=0 val=-1234500000000000000
739osmo_float_str_to_int("0.0345", 19) -> rc=0 val=345000000000000000
740osmo_float_str_to_int(".0345", 19) -> rc=0 val=345000000000000000
741osmo_float_str_to_int("-0.0345", 19) -> rc=0 val=-345000000000000000
742osmo_float_str_to_int("-.0345", 19) -> rc=0 val=-345000000000000000
743osmo_float_str_to_int(".2", 19) -> rc=0 val=2000000000000000000
744osmo_float_str_to_int("-.8", 19) -> rc=0 val=-8000000000000000000
745osmo_float_str_to_int(".1234567890123", 19) -> rc=0 val=1234567890123000000
746osmo_float_str_to_int(".1234567890123456789012345", 19) -> rc=0 val=1234567890123456789
747osmo_float_str_to_int("123.4567890123", 19) -> rc=-34=-ERANGE val=0
748osmo_float_str_to_int(".9223372036854775807", 19) -> rc=0 val=9223372036854775807
749osmo_float_str_to_int("-.9223372036854775807", 19) -> rc=0 val=-9223372036854775807
750osmo_float_str_to_int("-.9223372036854775808", 19) -> rc=-34=-ERANGE val=0
751osmo_float_str_to_int(".9223372036854775808", 19) -> rc=-34=-ERANGE val=0
752osmo_float_str_to_int("-.9223372036854775809", 19) -> rc=-34=-ERANGE val=0
753osmo_float_str_to_int("100000000000000000000", 19) -> rc=-34=-ERANGE val=0
754osmo_float_str_to_int("-100000000000000000000", 19) -> rc=-34=-ERANGE val=0
755osmo_float_str_to_int("999999999999999999999999999.99", 19) -> rc=-34=-ERANGE val=0
756osmo_float_str_to_int("-999999999999999999999999999.99", 19) -> rc=-34=-ERANGE val=0
757osmo_float_str_to_int("1.2.3", 19) -> rc=-22=-EINVAL val=0
758osmo_float_str_to_int("foo", 19) -> rc=-22=-EINVAL val=0
759osmo_float_str_to_int("1.foo", 19) -> rc=-22=-EINVAL val=0
760osmo_float_str_to_int("1.foo", 19) -> rc=-22=-EINVAL val=0
761osmo_float_str_to_int("12.-345", 19) -> rc=-22=-EINVAL val=0
762osmo_float_str_to_int("-12.-345", 19) -> rc=-22=-EINVAL val=0
763osmo_float_str_to_int("12.+345", 19) -> rc=-22=-EINVAL val=0
764osmo_float_str_to_int("+12.+345", 19) -> rc=-22=-EINVAL val=0
765osmo_float_str_to_int("", 19) -> rc=-22=-EINVAL val=0
766osmo_float_str_to_int(NULL, 19) -> rc=-22=-EINVAL val=0
767osmo_float_str_to_int("0", 20) -> rc=0 val=0
768osmo_float_str_to_int(".01", 20) -> rc=0 val=1000000000000000000
769osmo_float_str_to_int(".012345", 20) -> rc=0 val=1234500000000000000
770osmo_float_str_to_int("+.012345", 20) -> rc=0 val=1234500000000000000
771osmo_float_str_to_int("-.012345", 20) -> rc=0 val=-1234500000000000000
772osmo_float_str_to_int("0.00345", 20) -> rc=0 val=345000000000000000
773osmo_float_str_to_int(".00345", 20) -> rc=0 val=345000000000000000
774osmo_float_str_to_int("-0.00345", 20) -> rc=0 val=-345000000000000000
775osmo_float_str_to_int("-.00345", 20) -> rc=0 val=-345000000000000000
776osmo_float_str_to_int(".02", 20) -> rc=0 val=2000000000000000000
777osmo_float_str_to_int("-.08", 20) -> rc=0 val=-8000000000000000000
778osmo_float_str_to_int(".01234567890123", 20) -> rc=0 val=1234567890123000000
779osmo_float_str_to_int(".01234567890123456789012345", 20) -> rc=0 val=1234567890123456789
780osmo_float_str_to_int("12.34567890123", 20) -> rc=-34=-ERANGE val=0
781osmo_float_str_to_int(".09223372036854775807", 20) -> rc=0 val=9223372036854775807
782osmo_float_str_to_int("-.09223372036854775807", 20) -> rc=0 val=-9223372036854775807
783osmo_float_str_to_int("-.09223372036854775808", 20) -> rc=-34=-ERANGE val=0
784osmo_float_str_to_int(".09223372036854775808", 20) -> rc=-34=-ERANGE val=0
785osmo_float_str_to_int("-.09223372036854775809", 20) -> rc=-34=-ERANGE val=0
786osmo_float_str_to_int(".1", 20) -> rc=-34=-ERANGE val=0
787osmo_float_str_to_int("-.1", 20) -> rc=-34=-ERANGE val=0
788osmo_float_str_to_int("999999999999999999999999999.99", 20) -> rc=-34=-ERANGE val=0
789osmo_float_str_to_int("-999999999999999999999999999.99", 20) -> rc=-34=-ERANGE val=0
790osmo_float_str_to_int("1.2.3", 20) -> rc=-22=-EINVAL val=0
791osmo_float_str_to_int("foo", 20) -> rc=-22=-EINVAL val=0
792osmo_float_str_to_int("1.foo", 20) -> rc=-22=-EINVAL val=0
793osmo_float_str_to_int("1.foo", 20) -> rc=-22=-EINVAL val=0
794osmo_float_str_to_int("12.-345", 20) -> rc=-22=-EINVAL val=0
795osmo_float_str_to_int("-12.-345", 20) -> rc=-22=-EINVAL val=0
796osmo_float_str_to_int("12.+345", 20) -> rc=-22=-EINVAL val=0
797osmo_float_str_to_int("+12.+345", 20) -> rc=-22=-EINVAL val=0
798osmo_float_str_to_int("", 20) -> rc=-22=-EINVAL val=0
799osmo_float_str_to_int(NULL, 20) -> rc=-22=-EINVAL val=0
800osmo_float_str_to_int("0", 25) -> rc=0 val=0
801osmo_float_str_to_int(".0000001", 25) -> rc=0 val=1000000000000000000
802osmo_float_str_to_int(".00000012345", 25) -> rc=0 val=1234500000000000000
803osmo_float_str_to_int("+.00000012345", 25) -> rc=0 val=1234500000000000000
804osmo_float_str_to_int("-.00000012345", 25) -> rc=0 val=-1234500000000000000
805osmo_float_str_to_int("0.0000000345", 25) -> rc=0 val=345000000000000000
806osmo_float_str_to_int(".0000000345", 25) -> rc=0 val=345000000000000000
807osmo_float_str_to_int("-0.0000000345", 25) -> rc=0 val=-345000000000000000
808osmo_float_str_to_int("-.0000000345", 25) -> rc=0 val=-345000000000000000
809osmo_float_str_to_int(".0000002", 25) -> rc=0 val=2000000000000000000
810osmo_float_str_to_int("-.0000008", 25) -> rc=0 val=-8000000000000000000
811osmo_float_str_to_int(".0000001234567890123", 25) -> rc=0 val=1234567890123000000
812osmo_float_str_to_int(".0000001234567890123456789012345", 25) -> rc=0 val=1234567890123456789
813osmo_float_str_to_int(".0001234567890123", 25) -> rc=-34=-ERANGE val=0
814osmo_float_str_to_int(".0000009223372036854775807", 25) -> rc=0 val=9223372036854775807
815osmo_float_str_to_int("-.0000009223372036854775807", 25) -> rc=0 val=-9223372036854775807
816osmo_float_str_to_int("-.0000009223372036854775808", 25) -> rc=-34=-ERANGE val=0
817osmo_float_str_to_int(".0000009223372036854775808", 25) -> rc=-34=-ERANGE val=0
818osmo_float_str_to_int("-.0000009223372036854775809", 25) -> rc=-34=-ERANGE val=0
819osmo_float_str_to_int(".000001", 25) -> rc=-34=-ERANGE val=0
820osmo_float_str_to_int("-.000001", 25) -> rc=-34=-ERANGE val=0
821osmo_float_str_to_int("999999999999999999999999999.99", 25) -> rc=-34=-ERANGE val=0
822osmo_float_str_to_int("-999999999999999999999999999.99", 25) -> rc=-34=-ERANGE val=0
823osmo_float_str_to_int("1.2.3", 25) -> rc=-22=-EINVAL val=0
824osmo_float_str_to_int("foo", 25) -> rc=-22=-EINVAL val=0
825osmo_float_str_to_int("1.foo", 25) -> rc=-22=-EINVAL val=0
826osmo_float_str_to_int("1.foo", 25) -> rc=-22=-EINVAL val=0
827osmo_float_str_to_int("12.-345", 25) -> rc=-22=-EINVAL val=0
828osmo_float_str_to_int("-12.-345", 25) -> rc=-22=-EINVAL val=0
829osmo_float_str_to_int("12.+345", 25) -> rc=-22=-EINVAL val=0
830osmo_float_str_to_int("+12.+345", 25) -> rc=-22=-EINVAL val=0
831osmo_float_str_to_int("", 25) -> rc=-22=-EINVAL val=0
832osmo_float_str_to_int(NULL, 25) -> rc=-22=-EINVAL val=0
833--- test_int_to_float_str
834osmo_int_to_float_str_buf(0, 0) -> rc=1 str="0"
835osmo_int_to_float_str_buf(1, 0) -> rc=1 str="1"
836osmo_int_to_float_str_buf(1000000, 0) -> rc=7 str="1000000"
837osmo_int_to_float_str_buf(-1000000, 0) -> rc=8 str="-1000000"
838osmo_int_to_float_str_buf(1000001, 0) -> rc=7 str="1000001"
839osmo_int_to_float_str_buf(-1000001, 0) -> rc=8 str="-1000001"
840osmo_int_to_float_str_buf(1000100, 0) -> rc=7 str="1000100"
841osmo_int_to_float_str_buf(-1010000, 0) -> rc=8 str="-1010000"
842osmo_int_to_float_str_buf(1100000, 0) -> rc=7 str="1100000"
843osmo_int_to_float_str_buf(10000000, 0) -> rc=8 str="10000000"
844osmo_int_to_float_str_buf(-10000000, 0) -> rc=9 str="-10000000"
845osmo_int_to_float_str_buf(100000000, 0) -> rc=9 str="100000000"
846osmo_int_to_float_str_buf(-100000000, 0) -> rc=10 str="-100000000"
847osmo_int_to_float_str_buf(9223372036854775807, 0) -> rc=19 str="9223372036854775807"
848osmo_int_to_float_str_buf(-9223372036854775807, 0) -> rc=20 str="-9223372036854775807"
849osmo_int_to_float_str_buf(-9223372036854775808, 0) -> rc=4 str="-ERR"
850osmo_int_to_float_str_buf(0, 1) -> rc=1 str="0"
851osmo_int_to_float_str_buf(1, 1) -> rc=3 str="0.1"
852osmo_int_to_float_str_buf(1000000, 1) -> rc=6 str="100000"
853osmo_int_to_float_str_buf(-1000000, 1) -> rc=7 str="-100000"
854osmo_int_to_float_str_buf(1000001, 1) -> rc=8 str="100000.1"
855osmo_int_to_float_str_buf(-1000001, 1) -> rc=9 str="-100000.1"
856osmo_int_to_float_str_buf(1000100, 1) -> rc=6 str="100010"
857osmo_int_to_float_str_buf(-1010000, 1) -> rc=7 str="-101000"
858osmo_int_to_float_str_buf(1100000, 1) -> rc=6 str="110000"
859osmo_int_to_float_str_buf(10000000, 1) -> rc=7 str="1000000"
860osmo_int_to_float_str_buf(-10000000, 1) -> rc=8 str="-1000000"
861osmo_int_to_float_str_buf(100000000, 1) -> rc=8 str="10000000"
862osmo_int_to_float_str_buf(-100000000, 1) -> rc=9 str="-10000000"
863osmo_int_to_float_str_buf(9223372036854775807, 1) -> rc=20 str="922337203685477580.7"
864osmo_int_to_float_str_buf(-9223372036854775807, 1) -> rc=21 str="-922337203685477580.7"
865osmo_int_to_float_str_buf(-9223372036854775808, 1) -> rc=4 str="-ERR"
866osmo_int_to_float_str_buf(0, 3) -> rc=1 str="0"
867osmo_int_to_float_str_buf(1, 3) -> rc=5 str="0.001"
868osmo_int_to_float_str_buf(1000000, 3) -> rc=4 str="1000"
869osmo_int_to_float_str_buf(-1000000, 3) -> rc=5 str="-1000"
870osmo_int_to_float_str_buf(1000001, 3) -> rc=8 str="1000.001"
871osmo_int_to_float_str_buf(-1000001, 3) -> rc=9 str="-1000.001"
872osmo_int_to_float_str_buf(1000100, 3) -> rc=6 str="1000.1"
873osmo_int_to_float_str_buf(-1010000, 3) -> rc=5 str="-1010"
874osmo_int_to_float_str_buf(1100000, 3) -> rc=4 str="1100"
875osmo_int_to_float_str_buf(10000000, 3) -> rc=5 str="10000"
876osmo_int_to_float_str_buf(-10000000, 3) -> rc=6 str="-10000"
877osmo_int_to_float_str_buf(100000000, 3) -> rc=6 str="100000"
878osmo_int_to_float_str_buf(-100000000, 3) -> rc=7 str="-100000"
879osmo_int_to_float_str_buf(9223372036854775807, 3) -> rc=20 str="9223372036854775.807"
880osmo_int_to_float_str_buf(-9223372036854775807, 3) -> rc=21 str="-9223372036854775.807"
881osmo_int_to_float_str_buf(-9223372036854775808, 3) -> rc=4 str="-ERR"
882osmo_int_to_float_str_buf(0, 6) -> rc=1 str="0"
883osmo_int_to_float_str_buf(1, 6) -> rc=8 str="0.000001"
884osmo_int_to_float_str_buf(1000000, 6) -> rc=1 str="1"
885osmo_int_to_float_str_buf(-1000000, 6) -> rc=2 str="-1"
886osmo_int_to_float_str_buf(1000001, 6) -> rc=8 str="1.000001"
887osmo_int_to_float_str_buf(-1000001, 6) -> rc=9 str="-1.000001"
888osmo_int_to_float_str_buf(1000100, 6) -> rc=6 str="1.0001"
889osmo_int_to_float_str_buf(-1010000, 6) -> rc=5 str="-1.01"
890osmo_int_to_float_str_buf(1100000, 6) -> rc=3 str="1.1"
891osmo_int_to_float_str_buf(10000000, 6) -> rc=2 str="10"
892osmo_int_to_float_str_buf(-10000000, 6) -> rc=3 str="-10"
893osmo_int_to_float_str_buf(100000000, 6) -> rc=3 str="100"
894osmo_int_to_float_str_buf(-100000000, 6) -> rc=4 str="-100"
895osmo_int_to_float_str_buf(9223372036854775807, 6) -> rc=20 str="9223372036854.775807"
896osmo_int_to_float_str_buf(-9223372036854775807, 6) -> rc=21 str="-9223372036854.775807"
897osmo_int_to_float_str_buf(-9223372036854775808, 6) -> rc=4 str="-ERR"
898osmo_int_to_float_str_buf(0, 17) -> rc=1 str="0"
899osmo_int_to_float_str_buf(1, 17) -> rc=19 str="0.00000000000000001"
900osmo_int_to_float_str_buf(1000000, 17) -> rc=13 str="0.00000000001"
901osmo_int_to_float_str_buf(-1000000, 17) -> rc=14 str="-0.00000000001"
902osmo_int_to_float_str_buf(1000001, 17) -> rc=19 str="0.00000000001000001"
903osmo_int_to_float_str_buf(-1000001, 17) -> rc=20 str="-0.00000000001000001"
904osmo_int_to_float_str_buf(1000100, 17) -> rc=17 str="0.000000000010001"
905osmo_int_to_float_str_buf(-1010000, 17) -> rc=16 str="-0.0000000000101"
906osmo_int_to_float_str_buf(1100000, 17) -> rc=14 str="0.000000000011"
907osmo_int_to_float_str_buf(10000000, 17) -> rc=12 str="0.0000000001"
908osmo_int_to_float_str_buf(-10000000, 17) -> rc=13 str="-0.0000000001"
909osmo_int_to_float_str_buf(100000000, 17) -> rc=11 str="0.000000001"
910osmo_int_to_float_str_buf(-100000000, 17) -> rc=12 str="-0.000000001"
911osmo_int_to_float_str_buf(9223372036854775807, 17) -> rc=20 str="92.23372036854775807"
912osmo_int_to_float_str_buf(-9223372036854775807, 17) -> rc=21 str="-92.23372036854775807"
913osmo_int_to_float_str_buf(-9223372036854775808, 17) -> rc=4 str="-ERR"
914osmo_int_to_float_str_buf(0, 18) -> rc=1 str="0"
915osmo_int_to_float_str_buf(1, 18) -> rc=20 str="0.000000000000000001"
916osmo_int_to_float_str_buf(1000000, 18) -> rc=14 str="0.000000000001"
917osmo_int_to_float_str_buf(-1000000, 18) -> rc=15 str="-0.000000000001"
918osmo_int_to_float_str_buf(1000001, 18) -> rc=20 str="0.000000000001000001"
919osmo_int_to_float_str_buf(-1000001, 18) -> rc=21 str="-0.000000000001000001"
920osmo_int_to_float_str_buf(1000100, 18) -> rc=18 str="0.0000000000010001"
921osmo_int_to_float_str_buf(-1010000, 18) -> rc=17 str="-0.00000000000101"
922osmo_int_to_float_str_buf(1100000, 18) -> rc=15 str="0.0000000000011"
923osmo_int_to_float_str_buf(10000000, 18) -> rc=13 str="0.00000000001"
924osmo_int_to_float_str_buf(-10000000, 18) -> rc=14 str="-0.00000000001"
925osmo_int_to_float_str_buf(100000000, 18) -> rc=12 str="0.0000000001"
926osmo_int_to_float_str_buf(-100000000, 18) -> rc=13 str="-0.0000000001"
927osmo_int_to_float_str_buf(9223372036854775807, 18) -> rc=20 str="9.223372036854775807"
928osmo_int_to_float_str_buf(-9223372036854775807, 18) -> rc=21 str="-9.223372036854775807"
929osmo_int_to_float_str_buf(-9223372036854775808, 18) -> rc=4 str="-ERR"
930osmo_int_to_float_str_buf(0, 19) -> rc=1 str="0"
931osmo_int_to_float_str_buf(1, 19) -> rc=21 str="0.0000000000000000001"
932osmo_int_to_float_str_buf(1000000, 19) -> rc=15 str="0.0000000000001"
933osmo_int_to_float_str_buf(-1000000, 19) -> rc=16 str="-0.0000000000001"
934osmo_int_to_float_str_buf(1000001, 19) -> rc=21 str="0.0000000000001000001"
935osmo_int_to_float_str_buf(-1000001, 19) -> rc=22 str="-0.0000000000001000001"
936osmo_int_to_float_str_buf(1000100, 19) -> rc=19 str="0.00000000000010001"
937osmo_int_to_float_str_buf(-1010000, 19) -> rc=18 str="-0.000000000000101"
938osmo_int_to_float_str_buf(1100000, 19) -> rc=16 str="0.00000000000011"
939osmo_int_to_float_str_buf(10000000, 19) -> rc=14 str="0.000000000001"
940osmo_int_to_float_str_buf(-10000000, 19) -> rc=15 str="-0.000000000001"
941osmo_int_to_float_str_buf(100000000, 19) -> rc=13 str="0.00000000001"
942osmo_int_to_float_str_buf(-100000000, 19) -> rc=14 str="-0.00000000001"
943osmo_int_to_float_str_buf(9223372036854775807, 19) -> rc=21 str="0.9223372036854775807"
944osmo_int_to_float_str_buf(-9223372036854775807, 19) -> rc=22 str="-0.9223372036854775807"
945osmo_int_to_float_str_buf(-9223372036854775808, 19) -> rc=4 str="-ERR"
946osmo_int_to_float_str_buf(0, 23) -> rc=1 str="0"
947osmo_int_to_float_str_buf(1, 23) -> rc=25 str="0.00000000000000000000001"
948osmo_int_to_float_str_buf(1000000, 23) -> rc=19 str="0.00000000000000001"
949osmo_int_to_float_str_buf(-1000000, 23) -> rc=20 str="-0.00000000000000001"
950osmo_int_to_float_str_buf(1000001, 23) -> rc=25 str="0.00000000000000001000001"
951osmo_int_to_float_str_buf(-1000001, 23) -> rc=26 str="-0.00000000000000001000001"
952osmo_int_to_float_str_buf(1000100, 23) -> rc=23 str="0.000000000000000010001"
953osmo_int_to_float_str_buf(-1010000, 23) -> rc=22 str="-0.0000000000000000101"
954osmo_int_to_float_str_buf(1100000, 23) -> rc=20 str="0.000000000000000011"
955osmo_int_to_float_str_buf(10000000, 23) -> rc=18 str="0.0000000000000001"
956osmo_int_to_float_str_buf(-10000000, 23) -> rc=19 str="-0.0000000000000001"
957osmo_int_to_float_str_buf(100000000, 23) -> rc=17 str="0.000000000000001"
958osmo_int_to_float_str_buf(-100000000, 23) -> rc=18 str="-0.000000000000001"
959osmo_int_to_float_str_buf(9223372036854775807, 23) -> rc=25 str="0.00009223372036854775807"
960osmo_int_to_float_str_buf(-9223372036854775807, 23) -> rc=26 str="-0.00009223372036854775807"
961osmo_int_to_float_str_buf(-9223372036854775808, 23) -> rc=4 str="-ERR"
Neels Hofmeyr47773342021-09-05 18:48:31 +0200962--- test_str_to_int
963osmo_str_to_int(NULL, 10, -1000, 1000) -> rc=-22=-EINVAL val=0
964osmo_str_to_int("", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
965osmo_str_to_int(" ", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
966osmo_str_to_int("-", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
967osmo_str_to_int("--", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
968osmo_str_to_int("+", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
969osmo_str_to_int("++", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
970osmo_str_to_int("0", 10, -1000, 1000) -> rc=0 val=0
971osmo_str_to_int("1", 10, -1000, 1000) -> rc=0 val=1
972osmo_str_to_int("+1", 10, -1000, 1000) -> rc=0 val=1
973osmo_str_to_int("-1", 10, -1000, 1000) -> rc=0 val=-1
974osmo_str_to_int("1000", 10, -1000, 1000) -> rc=0 val=1000
975osmo_str_to_int("+1000", 10, -1000, 1000) -> rc=0 val=1000
976osmo_str_to_int("-1000", 10, -1000, 1000) -> rc=0 val=-1000
977osmo_str_to_int("1001", 10, -1000, 1000) -> rc=-34=-ERANGE val=1001
978osmo_str_to_int("+1001", 10, -1000, 1000) -> rc=-34=-ERANGE val=1001
979osmo_str_to_int("-1001", 10, -1000, 1000) -> rc=-34=-ERANGE val=-1001
980osmo_str_to_int("0", 16, -1000, 1000) -> rc=0 val=0
981osmo_str_to_int("1", 16, -1000, 1000) -> rc=0 val=1
982osmo_str_to_int("0x1", 16, -1000, 1000) -> rc=0 val=1
983osmo_str_to_int("+1", 16, -1000, 1000) -> rc=0 val=1
984osmo_str_to_int("-1", 16, -1000, 1000) -> rc=0 val=-1
985osmo_str_to_int("+0x1", 16, -1000, 1000) -> rc=0 val=1
986osmo_str_to_int("-0x1", 16, -1000, 1000) -> rc=0 val=-1
987osmo_str_to_int("3e8", 16, -1000, 1000) -> rc=0 val=1000
988osmo_str_to_int("3E8", 16, -1000, 1000) -> rc=0 val=1000
989osmo_str_to_int("0x3e8", 16, -1000, 1000) -> rc=0 val=1000
990osmo_str_to_int("0x3E8", 16, -1000, 1000) -> rc=0 val=1000
991osmo_str_to_int("+3e8", 16, -1000, 1000) -> rc=0 val=1000
992osmo_str_to_int("+3E8", 16, -1000, 1000) -> rc=0 val=1000
993osmo_str_to_int("+0x3e8", 16, -1000, 1000) -> rc=0 val=1000
994osmo_str_to_int("+0x3E8", 16, -1000, 1000) -> rc=0 val=1000
995osmo_str_to_int("-3e8", 16, -1000, 1000) -> rc=0 val=-1000
996osmo_str_to_int("-3E8", 16, -1000, 1000) -> rc=0 val=-1000
997osmo_str_to_int("-0x3e8", 16, -1000, 1000) -> rc=0 val=-1000
998osmo_str_to_int("-0x3E8", 16, -1000, 1000) -> rc=0 val=-1000
999osmo_str_to_int("3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1000osmo_str_to_int("3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1001osmo_str_to_int("0x3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1002osmo_str_to_int("0x3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1003osmo_str_to_int("+3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1004osmo_str_to_int("+3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1005osmo_str_to_int("+0x3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1006osmo_str_to_int("+0x3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1007osmo_str_to_int("-3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1008osmo_str_to_int("-3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1009osmo_str_to_int("-0x3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1010osmo_str_to_int("-0x3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1011osmo_str_to_int("garble", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1012osmo_str_to_int("-garble", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1013osmo_str_to_int("0x123", 10, -1000, 1000) -> rc=-7=-E2BIG val=0
1014osmo_str_to_int("123potatoes", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1015osmo_str_to_int("123 potatoes", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1016osmo_str_to_int("123 ", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1017osmo_str_to_int("123.4", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1018--- test_str_to_int64
1019osmo_str_to_int64(NULL, 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1020osmo_str_to_int64("", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1021osmo_str_to_int64(" ", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1022osmo_str_to_int64("-", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1023osmo_str_to_int64("--", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1024osmo_str_to_int64("+", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1025osmo_str_to_int64("++", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1026osmo_str_to_int64("0", 10, -1000, 1000) -> rc=0 val=0
1027osmo_str_to_int64("1", 10, -1000, 1000) -> rc=0 val=1
1028osmo_str_to_int64("+1", 10, -1000, 1000) -> rc=0 val=1
1029osmo_str_to_int64("-1", 10, -1000, 1000) -> rc=0 val=-1
1030osmo_str_to_int64("1000", 10, -1000, 1000) -> rc=0 val=1000
1031osmo_str_to_int64("+1000", 10, -1000, 1000) -> rc=0 val=1000
1032osmo_str_to_int64("-1000", 10, -1000, 1000) -> rc=0 val=-1000
1033osmo_str_to_int64("1001", 10, -1000, 1000) -> rc=-34=-ERANGE val=1001
1034osmo_str_to_int64("+1001", 10, -1000, 1000) -> rc=-34=-ERANGE val=1001
1035osmo_str_to_int64("-1001", 10, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1036osmo_str_to_int64("0", 16, -1000, 1000) -> rc=0 val=0
1037osmo_str_to_int64("1", 16, -1000, 1000) -> rc=0 val=1
1038osmo_str_to_int64("0x1", 16, -1000, 1000) -> rc=0 val=1
1039osmo_str_to_int64("+1", 16, -1000, 1000) -> rc=0 val=1
1040osmo_str_to_int64("-1", 16, -1000, 1000) -> rc=0 val=-1
1041osmo_str_to_int64("+0x1", 16, -1000, 1000) -> rc=0 val=1
1042osmo_str_to_int64("-0x1", 16, -1000, 1000) -> rc=0 val=-1
1043osmo_str_to_int64("3e8", 16, -1000, 1000) -> rc=0 val=1000
1044osmo_str_to_int64("3E8", 16, -1000, 1000) -> rc=0 val=1000
1045osmo_str_to_int64("0x3e8", 16, -1000, 1000) -> rc=0 val=1000
1046osmo_str_to_int64("0x3E8", 16, -1000, 1000) -> rc=0 val=1000
1047osmo_str_to_int64("+3e8", 16, -1000, 1000) -> rc=0 val=1000
1048osmo_str_to_int64("+3E8", 16, -1000, 1000) -> rc=0 val=1000
1049osmo_str_to_int64("+0x3e8", 16, -1000, 1000) -> rc=0 val=1000
1050osmo_str_to_int64("+0x3E8", 16, -1000, 1000) -> rc=0 val=1000
1051osmo_str_to_int64("-3e8", 16, -1000, 1000) -> rc=0 val=-1000
1052osmo_str_to_int64("-3E8", 16, -1000, 1000) -> rc=0 val=-1000
1053osmo_str_to_int64("-0x3e8", 16, -1000, 1000) -> rc=0 val=-1000
1054osmo_str_to_int64("-0x3E8", 16, -1000, 1000) -> rc=0 val=-1000
1055osmo_str_to_int64("3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1056osmo_str_to_int64("3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1057osmo_str_to_int64("0x3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1058osmo_str_to_int64("0x3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1059osmo_str_to_int64("+3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1060osmo_str_to_int64("+3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1061osmo_str_to_int64("+0x3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1062osmo_str_to_int64("+0x3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=1001
1063osmo_str_to_int64("-3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1064osmo_str_to_int64("-3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1065osmo_str_to_int64("-0x3e9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1066osmo_str_to_int64("-0x3E9", 16, -1000, 1000) -> rc=-34=-ERANGE val=-1001
1067osmo_str_to_int64("garble", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1068osmo_str_to_int64("-garble", 10, -1000, 1000) -> rc=-22=-EINVAL val=0
1069osmo_str_to_int64("0x123", 10, -1000, 1000) -> rc=-7=-E2BIG val=0
1070osmo_str_to_int64("123potatoes", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1071osmo_str_to_int64("123 potatoes", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1072osmo_str_to_int64("123 ", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1073osmo_str_to_int64("123.4", 10, -1000, 1000) -> rc=-7=-E2BIG val=123
1074osmo_str_to_int64("-9223372036854775808", 10, -9223372036854775808, 9223372036854775807) -> rc=0 val=-9223372036854775808
1075osmo_str_to_int64("9223372036854775807", 10, -9223372036854775808, 9223372036854775807) -> rc=0 val=9223372036854775807
1076osmo_str_to_int64("-9223372036854775809", 10, -9223372036854775808, 9223372036854775807) -> rc=-75=-EOVERFLOW val=-9223372036854775808
1077osmo_str_to_int64("9223372036854775808", 10, -9223372036854775808, 9223372036854775807) -> rc=-75=-EOVERFLOW val=9223372036854775807
1078osmo_str_to_int64("-9223372036854775808", 10, -1000, 1000) -> rc=-34=-ERANGE val=-9223372036854775808
1079osmo_str_to_int64("9223372036854775807", 10, -1000, 1000) -> rc=-34=-ERANGE val=9223372036854775807
1080osmo_str_to_int64("-9223372036854775809", 10, -1000, 1000) -> rc=-75=-EOVERFLOW val=-9223372036854775808
1081osmo_str_to_int64("9223372036854775808", 10, -1000, 1000) -> rc=-75=-EOVERFLOW val=9223372036854775807