| 154 | } |
| 155 | |
| 156 | void testParseValueOverflow() { |
| 157 | bool ok; |
| 158 | // UInt8: 300 exceeds uint8_t max (255) → should fail |
| 159 | fmt::parseValue(NodeKind::UInt8, "300", &ok); |
| 160 | QVERIFY(!ok); |
| 161 | |
| 162 | // UInt8: 255 should succeed |
| 163 | QByteArray b = fmt::parseValue(NodeKind::UInt8, "255", &ok); |
| 164 | QVERIFY(ok); |
| 165 | QCOMPARE((uint8_t)b[0], (uint8_t)255); |
| 166 | |
| 167 | // Int8: 200 exceeds int8_t max (127) → should fail |
| 168 | fmt::parseValue(NodeKind::Int8, "200", &ok); |
| 169 | QVERIFY(!ok); |
| 170 | |
| 171 | // Int8: -129 below min → should fail |
| 172 | fmt::parseValue(NodeKind::Int8, "-129", &ok); |
| 173 | QVERIFY(!ok); |
| 174 | |
| 175 | // Int8: -128 is valid |
| 176 | b = fmt::parseValue(NodeKind::Int8, "-128", &ok); |
| 177 | QVERIFY(ok); |
| 178 | int8_t sv; |
| 179 | memcpy(&sv, b.data(), 1); |
| 180 | QCOMPARE(sv, (int8_t)-128); |
| 181 | |
| 182 | // UInt16: 70000 exceeds uint16_t max → should fail |
| 183 | fmt::parseValue(NodeKind::UInt16, "70000", &ok); |
| 184 | QVERIFY(!ok); |
| 185 | |
| 186 | // Hex8: 0x1FF exceeds uint8_t → should fail |
| 187 | fmt::parseValue(NodeKind::Hex8, "1FF", &ok); |
| 188 | QVERIFY(!ok); |
| 189 | |
| 190 | // Hex16: 0x1FFFF exceeds uint16_t → should fail |
| 191 | fmt::parseValue(NodeKind::Hex16, "1FFFF", &ok); |
| 192 | QVERIFY(!ok); |
| 193 | } |
| 194 | |
| 195 | void testSignedHexRoundTrip() { |
| 196 | bool ok; |
nothing calls this directly
no test coverage detected