| 40 | } |
| 41 | |
| 42 | static void test_conversions() |
| 43 | { |
| 44 | /* Simple one-byte intervals. */ |
| 45 | |
| 46 | test_convert(Bytes{1, 1, 1, 1, 0}, Bytes{0x82, 0x82, 0x82, 0x82}); |
| 47 | |
| 48 | /* Larger one-byte intervals. */ |
| 49 | |
| 50 | test_convert(Bytes{32, 0}, Bytes{0x3f, 0x81}); |
| 51 | |
| 52 | test_convert(Bytes{64, 0}, Bytes{0x3f, 0x3f, 0x82}); |
| 53 | |
| 54 | test_convert(Bytes{128, 0}, Bytes{0x3f, 0x3f, 0x3f, 0x3f, 0x84}); |
| 55 | |
| 56 | /* Two-byte intervals. */ |
| 57 | |
| 58 | test_convert(Bytes{250, 1, 0}, |
| 59 | Bytes{0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xbb}); |
| 60 | |
| 61 | /* Very long intervals. */ |
| 62 | |
| 63 | test_convert(Bytes{255, FLUXOP_SPACE, E28(2048 - 249), 249, 0}, |
| 64 | Bytes{0x3f} * 0x41 + Bytes{0x81}); |
| 65 | } |
| 66 | |
| 67 | int main(int argc, const char* argv[]) |
| 68 | { |