1 ubyte[9] data; 2 3 alias AliasSeq(T...) = T; 4 5 foreach(T; AliasSeq!(ubyte, ushort, uint, ulong)) 6 { 7 data[] = 0; 8 assert(ionPutIntField!T(data.ptr, 0, false) == 0, T.stringof); 9 10 data[] = 0; 11 assert(ionPutIntField!T(data.ptr, 0, true) == 1); 12 assert(data[0] == 0x80); 13 14 data[] = 0; 15 assert(ionPutIntField!T(data.ptr, 1, false) == 1); 16 assert(data[0] == 0x01); 17 18 data[] = 0; 19 assert(ionPutIntField!T(data.ptr, 1, true) == 1); 20 assert(data[0] == 0x81); 21 22 data[] = 0; 23 assert(ionPutIntField!T(data.ptr, 0x3F, true) == 1); 24 assert(data[0] == 0xBF); 25 26 data[] = 0; 27 assert(ionPutIntField!T(data.ptr, 0xFF, false) == 2); 28 assert(data[0] == 0x00); 29 assert(data[1] == 0xFF); 30 31 data[] = 0; 32 assert(ionPutIntField!T(data.ptr, 0xFF, true) == 2); 33 assert(data[0] == 0x80); 34 assert(data[1] == 0xFF); 35 36 data[] = 0; 37 assert(ionPutIntField!T(data.ptr, 0x80, true) == 2); 38 assert(data[0] == 0x80); 39 assert(data[1] == 0x80); 40 } 41 42 data[] = 0; 43 assert(ionPutIntField(data.ptr, int.max) == 4); 44 assert(data[0] == 0x7F); 45 assert(data[1] == 0xFF); 46 assert(data[2] == 0xFF); 47 assert(data[3] == 0xFF); 48 49 data[] = 0; 50 assert(ionPutIntField(data.ptr, int.min) == 5); 51 assert(data[0] == 0x80); 52 assert(data[1] == 0x80); 53 assert(data[2] == 0x00); 54 assert(data[3] == 0x00); 55 assert(data[4] == 0x00); 56 57 data[] = 0; 58 assert(ionPutIntField(data.ptr, long.max >> 1) == 8); 59 assert(data[0] == 0x3F); 60 assert(data[1] == 0xFF); 61 assert(data[2] == 0xFF); 62 assert(data[3] == 0xFF); 63 assert(data[4] == 0xFF); 64 assert(data[5] == 0xFF); 65 assert(data[6] == 0xFF); 66 assert(data[7] == 0xFF); 67 68 data[] = 0; 69 assert(ionPutIntField(data.ptr, ulong(long.max >> 1), true) == 8); 70 assert(data[0] == 0xBF); 71 assert(data[1] == 0xFF); 72 assert(data[2] == 0xFF); 73 assert(data[3] == 0xFF); 74 assert(data[4] == 0xFF); 75 assert(data[5] == 0xFF); 76 assert(data[6] == 0xFF); 77 assert(data[7] == 0xFF); 78 79 data[] = 0; 80 assert(ionPutIntField(data.ptr, long.max) == 8); 81 assert(data[0] == 0x7F); 82 assert(data[1] == 0xFF); 83 assert(data[2] == 0xFF); 84 assert(data[3] == 0xFF); 85 assert(data[4] == 0xFF); 86 assert(data[5] == 0xFF); 87 assert(data[6] == 0xFF); 88 assert(data[7] == 0xFF); 89 90 data[] = 0; 91 assert(ionPutIntField(data.ptr, ulong(long.max), true) == 8); 92 assert(data[0] == 0xFF); 93 assert(data[1] == 0xFF); 94 assert(data[2] == 0xFF); 95 assert(data[3] == 0xFF); 96 assert(data[4] == 0xFF); 97 assert(data[5] == 0xFF); 98 assert(data[6] == 0xFF); 99 assert(data[7] == 0xFF); 100 101 data[] = 0; 102 assert(ionPutIntField!ulong(data.ptr, long.max + 1, false) == 9); 103 assert(data[0] == 0x00); 104 assert(data[1] == 0x80); 105 assert(data[2] == 0x00); 106 assert(data[3] == 0x00); 107 assert(data[4] == 0x00); 108 assert(data[5] == 0x00); 109 assert(data[6] == 0x00); 110 assert(data[7] == 0x00); 111 assert(data[8] == 0x00); 112 113 data[] = 0; 114 assert(ionPutIntField(data.ptr, ulong.max, true) == 9); 115 assert(data[0] == 0x80); 116 assert(data[1] == 0xFF); 117 assert(data[2] == 0xFF); 118 assert(data[3] == 0xFF); 119 assert(data[4] == 0xFF); 120 assert(data[5] == 0xFF); 121 assert(data[6] == 0xFF); 122 assert(data[7] == 0xFF); 123 assert(data[8] == 0xFF);