Packing.t.sol 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. // SPDX-License-Identifier: MIT
  2. // This file was procedurally generated from scripts/generate/templates/Packing.t.js.
  3. pragma solidity ^0.8.20;
  4. import {Test} from "forge-std/Test.sol";
  5. import {Packing} from "@openzeppelin/contracts/utils/Packing.sol";
  6. contract PackingTest is Test {
  7. using Packing for *;
  8. function testSymbolicPack(bytes1 left, bytes1 right) external pure {
  9. assertEq(left, Packing.pack_1_1(left, right).extract_2_1(0));
  10. assertEq(right, Packing.pack_1_1(left, right).extract_2_1(1));
  11. }
  12. function testSymbolicPack(bytes2 left, bytes2 right) external pure {
  13. assertEq(left, Packing.pack_2_2(left, right).extract_4_2(0));
  14. assertEq(right, Packing.pack_2_2(left, right).extract_4_2(2));
  15. }
  16. function testSymbolicPack(bytes2 left, bytes4 right) external pure {
  17. assertEq(left, Packing.pack_2_4(left, right).extract_6_2(0));
  18. assertEq(right, Packing.pack_2_4(left, right).extract_6_4(2));
  19. }
  20. function testSymbolicPack(bytes2 left, bytes6 right) external pure {
  21. assertEq(left, Packing.pack_2_6(left, right).extract_8_2(0));
  22. assertEq(right, Packing.pack_2_6(left, right).extract_8_6(2));
  23. }
  24. function testSymbolicPack(bytes2 left, bytes8 right) external pure {
  25. assertEq(left, Packing.pack_2_8(left, right).extract_10_2(0));
  26. assertEq(right, Packing.pack_2_8(left, right).extract_10_8(2));
  27. }
  28. function testSymbolicPack(bytes2 left, bytes10 right) external pure {
  29. assertEq(left, Packing.pack_2_10(left, right).extract_12_2(0));
  30. assertEq(right, Packing.pack_2_10(left, right).extract_12_10(2));
  31. }
  32. function testSymbolicPack(bytes2 left, bytes20 right) external pure {
  33. assertEq(left, Packing.pack_2_20(left, right).extract_22_2(0));
  34. assertEq(right, Packing.pack_2_20(left, right).extract_22_20(2));
  35. }
  36. function testSymbolicPack(bytes2 left, bytes22 right) external pure {
  37. assertEq(left, Packing.pack_2_22(left, right).extract_24_2(0));
  38. assertEq(right, Packing.pack_2_22(left, right).extract_24_22(2));
  39. }
  40. function testSymbolicPack(bytes4 left, bytes2 right) external pure {
  41. assertEq(left, Packing.pack_4_2(left, right).extract_6_4(0));
  42. assertEq(right, Packing.pack_4_2(left, right).extract_6_2(4));
  43. }
  44. function testSymbolicPack(bytes4 left, bytes4 right) external pure {
  45. assertEq(left, Packing.pack_4_4(left, right).extract_8_4(0));
  46. assertEq(right, Packing.pack_4_4(left, right).extract_8_4(4));
  47. }
  48. function testSymbolicPack(bytes4 left, bytes6 right) external pure {
  49. assertEq(left, Packing.pack_4_6(left, right).extract_10_4(0));
  50. assertEq(right, Packing.pack_4_6(left, right).extract_10_6(4));
  51. }
  52. function testSymbolicPack(bytes4 left, bytes8 right) external pure {
  53. assertEq(left, Packing.pack_4_8(left, right).extract_12_4(0));
  54. assertEq(right, Packing.pack_4_8(left, right).extract_12_8(4));
  55. }
  56. function testSymbolicPack(bytes4 left, bytes12 right) external pure {
  57. assertEq(left, Packing.pack_4_12(left, right).extract_16_4(0));
  58. assertEq(right, Packing.pack_4_12(left, right).extract_16_12(4));
  59. }
  60. function testSymbolicPack(bytes4 left, bytes16 right) external pure {
  61. assertEq(left, Packing.pack_4_16(left, right).extract_20_4(0));
  62. assertEq(right, Packing.pack_4_16(left, right).extract_20_16(4));
  63. }
  64. function testSymbolicPack(bytes4 left, bytes20 right) external pure {
  65. assertEq(left, Packing.pack_4_20(left, right).extract_24_4(0));
  66. assertEq(right, Packing.pack_4_20(left, right).extract_24_20(4));
  67. }
  68. function testSymbolicPack(bytes4 left, bytes24 right) external pure {
  69. assertEq(left, Packing.pack_4_24(left, right).extract_28_4(0));
  70. assertEq(right, Packing.pack_4_24(left, right).extract_28_24(4));
  71. }
  72. function testSymbolicPack(bytes4 left, bytes28 right) external pure {
  73. assertEq(left, Packing.pack_4_28(left, right).extract_32_4(0));
  74. assertEq(right, Packing.pack_4_28(left, right).extract_32_28(4));
  75. }
  76. function testSymbolicPack(bytes6 left, bytes2 right) external pure {
  77. assertEq(left, Packing.pack_6_2(left, right).extract_8_6(0));
  78. assertEq(right, Packing.pack_6_2(left, right).extract_8_2(6));
  79. }
  80. function testSymbolicPack(bytes6 left, bytes4 right) external pure {
  81. assertEq(left, Packing.pack_6_4(left, right).extract_10_6(0));
  82. assertEq(right, Packing.pack_6_4(left, right).extract_10_4(6));
  83. }
  84. function testSymbolicPack(bytes6 left, bytes6 right) external pure {
  85. assertEq(left, Packing.pack_6_6(left, right).extract_12_6(0));
  86. assertEq(right, Packing.pack_6_6(left, right).extract_12_6(6));
  87. }
  88. function testSymbolicPack(bytes6 left, bytes10 right) external pure {
  89. assertEq(left, Packing.pack_6_10(left, right).extract_16_6(0));
  90. assertEq(right, Packing.pack_6_10(left, right).extract_16_10(6));
  91. }
  92. function testSymbolicPack(bytes6 left, bytes16 right) external pure {
  93. assertEq(left, Packing.pack_6_16(left, right).extract_22_6(0));
  94. assertEq(right, Packing.pack_6_16(left, right).extract_22_16(6));
  95. }
  96. function testSymbolicPack(bytes6 left, bytes22 right) external pure {
  97. assertEq(left, Packing.pack_6_22(left, right).extract_28_6(0));
  98. assertEq(right, Packing.pack_6_22(left, right).extract_28_22(6));
  99. }
  100. function testSymbolicPack(bytes8 left, bytes2 right) external pure {
  101. assertEq(left, Packing.pack_8_2(left, right).extract_10_8(0));
  102. assertEq(right, Packing.pack_8_2(left, right).extract_10_2(8));
  103. }
  104. function testSymbolicPack(bytes8 left, bytes4 right) external pure {
  105. assertEq(left, Packing.pack_8_4(left, right).extract_12_8(0));
  106. assertEq(right, Packing.pack_8_4(left, right).extract_12_4(8));
  107. }
  108. function testSymbolicPack(bytes8 left, bytes8 right) external pure {
  109. assertEq(left, Packing.pack_8_8(left, right).extract_16_8(0));
  110. assertEq(right, Packing.pack_8_8(left, right).extract_16_8(8));
  111. }
  112. function testSymbolicPack(bytes8 left, bytes12 right) external pure {
  113. assertEq(left, Packing.pack_8_12(left, right).extract_20_8(0));
  114. assertEq(right, Packing.pack_8_12(left, right).extract_20_12(8));
  115. }
  116. function testSymbolicPack(bytes8 left, bytes16 right) external pure {
  117. assertEq(left, Packing.pack_8_16(left, right).extract_24_8(0));
  118. assertEq(right, Packing.pack_8_16(left, right).extract_24_16(8));
  119. }
  120. function testSymbolicPack(bytes8 left, bytes20 right) external pure {
  121. assertEq(left, Packing.pack_8_20(left, right).extract_28_8(0));
  122. assertEq(right, Packing.pack_8_20(left, right).extract_28_20(8));
  123. }
  124. function testSymbolicPack(bytes8 left, bytes24 right) external pure {
  125. assertEq(left, Packing.pack_8_24(left, right).extract_32_8(0));
  126. assertEq(right, Packing.pack_8_24(left, right).extract_32_24(8));
  127. }
  128. function testSymbolicPack(bytes10 left, bytes2 right) external pure {
  129. assertEq(left, Packing.pack_10_2(left, right).extract_12_10(0));
  130. assertEq(right, Packing.pack_10_2(left, right).extract_12_2(10));
  131. }
  132. function testSymbolicPack(bytes10 left, bytes6 right) external pure {
  133. assertEq(left, Packing.pack_10_6(left, right).extract_16_10(0));
  134. assertEq(right, Packing.pack_10_6(left, right).extract_16_6(10));
  135. }
  136. function testSymbolicPack(bytes10 left, bytes10 right) external pure {
  137. assertEq(left, Packing.pack_10_10(left, right).extract_20_10(0));
  138. assertEq(right, Packing.pack_10_10(left, right).extract_20_10(10));
  139. }
  140. function testSymbolicPack(bytes10 left, bytes12 right) external pure {
  141. assertEq(left, Packing.pack_10_12(left, right).extract_22_10(0));
  142. assertEq(right, Packing.pack_10_12(left, right).extract_22_12(10));
  143. }
  144. function testSymbolicPack(bytes10 left, bytes22 right) external pure {
  145. assertEq(left, Packing.pack_10_22(left, right).extract_32_10(0));
  146. assertEq(right, Packing.pack_10_22(left, right).extract_32_22(10));
  147. }
  148. function testSymbolicPack(bytes12 left, bytes4 right) external pure {
  149. assertEq(left, Packing.pack_12_4(left, right).extract_16_12(0));
  150. assertEq(right, Packing.pack_12_4(left, right).extract_16_4(12));
  151. }
  152. function testSymbolicPack(bytes12 left, bytes8 right) external pure {
  153. assertEq(left, Packing.pack_12_8(left, right).extract_20_12(0));
  154. assertEq(right, Packing.pack_12_8(left, right).extract_20_8(12));
  155. }
  156. function testSymbolicPack(bytes12 left, bytes10 right) external pure {
  157. assertEq(left, Packing.pack_12_10(left, right).extract_22_12(0));
  158. assertEq(right, Packing.pack_12_10(left, right).extract_22_10(12));
  159. }
  160. function testSymbolicPack(bytes12 left, bytes12 right) external pure {
  161. assertEq(left, Packing.pack_12_12(left, right).extract_24_12(0));
  162. assertEq(right, Packing.pack_12_12(left, right).extract_24_12(12));
  163. }
  164. function testSymbolicPack(bytes12 left, bytes16 right) external pure {
  165. assertEq(left, Packing.pack_12_16(left, right).extract_28_12(0));
  166. assertEq(right, Packing.pack_12_16(left, right).extract_28_16(12));
  167. }
  168. function testSymbolicPack(bytes12 left, bytes20 right) external pure {
  169. assertEq(left, Packing.pack_12_20(left, right).extract_32_12(0));
  170. assertEq(right, Packing.pack_12_20(left, right).extract_32_20(12));
  171. }
  172. function testSymbolicPack(bytes16 left, bytes4 right) external pure {
  173. assertEq(left, Packing.pack_16_4(left, right).extract_20_16(0));
  174. assertEq(right, Packing.pack_16_4(left, right).extract_20_4(16));
  175. }
  176. function testSymbolicPack(bytes16 left, bytes6 right) external pure {
  177. assertEq(left, Packing.pack_16_6(left, right).extract_22_16(0));
  178. assertEq(right, Packing.pack_16_6(left, right).extract_22_6(16));
  179. }
  180. function testSymbolicPack(bytes16 left, bytes8 right) external pure {
  181. assertEq(left, Packing.pack_16_8(left, right).extract_24_16(0));
  182. assertEq(right, Packing.pack_16_8(left, right).extract_24_8(16));
  183. }
  184. function testSymbolicPack(bytes16 left, bytes12 right) external pure {
  185. assertEq(left, Packing.pack_16_12(left, right).extract_28_16(0));
  186. assertEq(right, Packing.pack_16_12(left, right).extract_28_12(16));
  187. }
  188. function testSymbolicPack(bytes16 left, bytes16 right) external pure {
  189. assertEq(left, Packing.pack_16_16(left, right).extract_32_16(0));
  190. assertEq(right, Packing.pack_16_16(left, right).extract_32_16(16));
  191. }
  192. function testSymbolicPack(bytes20 left, bytes2 right) external pure {
  193. assertEq(left, Packing.pack_20_2(left, right).extract_22_20(0));
  194. assertEq(right, Packing.pack_20_2(left, right).extract_22_2(20));
  195. }
  196. function testSymbolicPack(bytes20 left, bytes4 right) external pure {
  197. assertEq(left, Packing.pack_20_4(left, right).extract_24_20(0));
  198. assertEq(right, Packing.pack_20_4(left, right).extract_24_4(20));
  199. }
  200. function testSymbolicPack(bytes20 left, bytes8 right) external pure {
  201. assertEq(left, Packing.pack_20_8(left, right).extract_28_20(0));
  202. assertEq(right, Packing.pack_20_8(left, right).extract_28_8(20));
  203. }
  204. function testSymbolicPack(bytes20 left, bytes12 right) external pure {
  205. assertEq(left, Packing.pack_20_12(left, right).extract_32_20(0));
  206. assertEq(right, Packing.pack_20_12(left, right).extract_32_12(20));
  207. }
  208. function testSymbolicPack(bytes22 left, bytes2 right) external pure {
  209. assertEq(left, Packing.pack_22_2(left, right).extract_24_22(0));
  210. assertEq(right, Packing.pack_22_2(left, right).extract_24_2(22));
  211. }
  212. function testSymbolicPack(bytes22 left, bytes6 right) external pure {
  213. assertEq(left, Packing.pack_22_6(left, right).extract_28_22(0));
  214. assertEq(right, Packing.pack_22_6(left, right).extract_28_6(22));
  215. }
  216. function testSymbolicPack(bytes22 left, bytes10 right) external pure {
  217. assertEq(left, Packing.pack_22_10(left, right).extract_32_22(0));
  218. assertEq(right, Packing.pack_22_10(left, right).extract_32_10(22));
  219. }
  220. function testSymbolicPack(bytes24 left, bytes4 right) external pure {
  221. assertEq(left, Packing.pack_24_4(left, right).extract_28_24(0));
  222. assertEq(right, Packing.pack_24_4(left, right).extract_28_4(24));
  223. }
  224. function testSymbolicPack(bytes24 left, bytes8 right) external pure {
  225. assertEq(left, Packing.pack_24_8(left, right).extract_32_24(0));
  226. assertEq(right, Packing.pack_24_8(left, right).extract_32_8(24));
  227. }
  228. function testSymbolicPack(bytes28 left, bytes4 right) external pure {
  229. assertEq(left, Packing.pack_28_4(left, right).extract_32_28(0));
  230. assertEq(right, Packing.pack_28_4(left, right).extract_32_4(28));
  231. }
  232. function testSymbolicReplace(bytes2 container, bytes1 newValue, uint8 offset) external pure {
  233. offset = uint8(bound(offset, 0, 1));
  234. bytes1 oldValue = container.extract_2_1(offset);
  235. assertEq(newValue, container.replace_2_1(newValue, offset).extract_2_1(offset));
  236. assertEq(container, container.replace_2_1(newValue, offset).replace_2_1(oldValue, offset));
  237. }
  238. function testSymbolicReplace(bytes4 container, bytes1 newValue, uint8 offset) external pure {
  239. offset = uint8(bound(offset, 0, 3));
  240. bytes1 oldValue = container.extract_4_1(offset);
  241. assertEq(newValue, container.replace_4_1(newValue, offset).extract_4_1(offset));
  242. assertEq(container, container.replace_4_1(newValue, offset).replace_4_1(oldValue, offset));
  243. }
  244. function testSymbolicReplace(bytes4 container, bytes2 newValue, uint8 offset) external pure {
  245. offset = uint8(bound(offset, 0, 2));
  246. bytes2 oldValue = container.extract_4_2(offset);
  247. assertEq(newValue, container.replace_4_2(newValue, offset).extract_4_2(offset));
  248. assertEq(container, container.replace_4_2(newValue, offset).replace_4_2(oldValue, offset));
  249. }
  250. function testSymbolicReplace(bytes6 container, bytes1 newValue, uint8 offset) external pure {
  251. offset = uint8(bound(offset, 0, 5));
  252. bytes1 oldValue = container.extract_6_1(offset);
  253. assertEq(newValue, container.replace_6_1(newValue, offset).extract_6_1(offset));
  254. assertEq(container, container.replace_6_1(newValue, offset).replace_6_1(oldValue, offset));
  255. }
  256. function testSymbolicReplace(bytes6 container, bytes2 newValue, uint8 offset) external pure {
  257. offset = uint8(bound(offset, 0, 4));
  258. bytes2 oldValue = container.extract_6_2(offset);
  259. assertEq(newValue, container.replace_6_2(newValue, offset).extract_6_2(offset));
  260. assertEq(container, container.replace_6_2(newValue, offset).replace_6_2(oldValue, offset));
  261. }
  262. function testSymbolicReplace(bytes6 container, bytes4 newValue, uint8 offset) external pure {
  263. offset = uint8(bound(offset, 0, 2));
  264. bytes4 oldValue = container.extract_6_4(offset);
  265. assertEq(newValue, container.replace_6_4(newValue, offset).extract_6_4(offset));
  266. assertEq(container, container.replace_6_4(newValue, offset).replace_6_4(oldValue, offset));
  267. }
  268. function testSymbolicReplace(bytes8 container, bytes1 newValue, uint8 offset) external pure {
  269. offset = uint8(bound(offset, 0, 7));
  270. bytes1 oldValue = container.extract_8_1(offset);
  271. assertEq(newValue, container.replace_8_1(newValue, offset).extract_8_1(offset));
  272. assertEq(container, container.replace_8_1(newValue, offset).replace_8_1(oldValue, offset));
  273. }
  274. function testSymbolicReplace(bytes8 container, bytes2 newValue, uint8 offset) external pure {
  275. offset = uint8(bound(offset, 0, 6));
  276. bytes2 oldValue = container.extract_8_2(offset);
  277. assertEq(newValue, container.replace_8_2(newValue, offset).extract_8_2(offset));
  278. assertEq(container, container.replace_8_2(newValue, offset).replace_8_2(oldValue, offset));
  279. }
  280. function testSymbolicReplace(bytes8 container, bytes4 newValue, uint8 offset) external pure {
  281. offset = uint8(bound(offset, 0, 4));
  282. bytes4 oldValue = container.extract_8_4(offset);
  283. assertEq(newValue, container.replace_8_4(newValue, offset).extract_8_4(offset));
  284. assertEq(container, container.replace_8_4(newValue, offset).replace_8_4(oldValue, offset));
  285. }
  286. function testSymbolicReplace(bytes8 container, bytes6 newValue, uint8 offset) external pure {
  287. offset = uint8(bound(offset, 0, 2));
  288. bytes6 oldValue = container.extract_8_6(offset);
  289. assertEq(newValue, container.replace_8_6(newValue, offset).extract_8_6(offset));
  290. assertEq(container, container.replace_8_6(newValue, offset).replace_8_6(oldValue, offset));
  291. }
  292. function testSymbolicReplace(bytes10 container, bytes1 newValue, uint8 offset) external pure {
  293. offset = uint8(bound(offset, 0, 9));
  294. bytes1 oldValue = container.extract_10_1(offset);
  295. assertEq(newValue, container.replace_10_1(newValue, offset).extract_10_1(offset));
  296. assertEq(container, container.replace_10_1(newValue, offset).replace_10_1(oldValue, offset));
  297. }
  298. function testSymbolicReplace(bytes10 container, bytes2 newValue, uint8 offset) external pure {
  299. offset = uint8(bound(offset, 0, 8));
  300. bytes2 oldValue = container.extract_10_2(offset);
  301. assertEq(newValue, container.replace_10_2(newValue, offset).extract_10_2(offset));
  302. assertEq(container, container.replace_10_2(newValue, offset).replace_10_2(oldValue, offset));
  303. }
  304. function testSymbolicReplace(bytes10 container, bytes4 newValue, uint8 offset) external pure {
  305. offset = uint8(bound(offset, 0, 6));
  306. bytes4 oldValue = container.extract_10_4(offset);
  307. assertEq(newValue, container.replace_10_4(newValue, offset).extract_10_4(offset));
  308. assertEq(container, container.replace_10_4(newValue, offset).replace_10_4(oldValue, offset));
  309. }
  310. function testSymbolicReplace(bytes10 container, bytes6 newValue, uint8 offset) external pure {
  311. offset = uint8(bound(offset, 0, 4));
  312. bytes6 oldValue = container.extract_10_6(offset);
  313. assertEq(newValue, container.replace_10_6(newValue, offset).extract_10_6(offset));
  314. assertEq(container, container.replace_10_6(newValue, offset).replace_10_6(oldValue, offset));
  315. }
  316. function testSymbolicReplace(bytes10 container, bytes8 newValue, uint8 offset) external pure {
  317. offset = uint8(bound(offset, 0, 2));
  318. bytes8 oldValue = container.extract_10_8(offset);
  319. assertEq(newValue, container.replace_10_8(newValue, offset).extract_10_8(offset));
  320. assertEq(container, container.replace_10_8(newValue, offset).replace_10_8(oldValue, offset));
  321. }
  322. function testSymbolicReplace(bytes12 container, bytes1 newValue, uint8 offset) external pure {
  323. offset = uint8(bound(offset, 0, 11));
  324. bytes1 oldValue = container.extract_12_1(offset);
  325. assertEq(newValue, container.replace_12_1(newValue, offset).extract_12_1(offset));
  326. assertEq(container, container.replace_12_1(newValue, offset).replace_12_1(oldValue, offset));
  327. }
  328. function testSymbolicReplace(bytes12 container, bytes2 newValue, uint8 offset) external pure {
  329. offset = uint8(bound(offset, 0, 10));
  330. bytes2 oldValue = container.extract_12_2(offset);
  331. assertEq(newValue, container.replace_12_2(newValue, offset).extract_12_2(offset));
  332. assertEq(container, container.replace_12_2(newValue, offset).replace_12_2(oldValue, offset));
  333. }
  334. function testSymbolicReplace(bytes12 container, bytes4 newValue, uint8 offset) external pure {
  335. offset = uint8(bound(offset, 0, 8));
  336. bytes4 oldValue = container.extract_12_4(offset);
  337. assertEq(newValue, container.replace_12_4(newValue, offset).extract_12_4(offset));
  338. assertEq(container, container.replace_12_4(newValue, offset).replace_12_4(oldValue, offset));
  339. }
  340. function testSymbolicReplace(bytes12 container, bytes6 newValue, uint8 offset) external pure {
  341. offset = uint8(bound(offset, 0, 6));
  342. bytes6 oldValue = container.extract_12_6(offset);
  343. assertEq(newValue, container.replace_12_6(newValue, offset).extract_12_6(offset));
  344. assertEq(container, container.replace_12_6(newValue, offset).replace_12_6(oldValue, offset));
  345. }
  346. function testSymbolicReplace(bytes12 container, bytes8 newValue, uint8 offset) external pure {
  347. offset = uint8(bound(offset, 0, 4));
  348. bytes8 oldValue = container.extract_12_8(offset);
  349. assertEq(newValue, container.replace_12_8(newValue, offset).extract_12_8(offset));
  350. assertEq(container, container.replace_12_8(newValue, offset).replace_12_8(oldValue, offset));
  351. }
  352. function testSymbolicReplace(bytes12 container, bytes10 newValue, uint8 offset) external pure {
  353. offset = uint8(bound(offset, 0, 2));
  354. bytes10 oldValue = container.extract_12_10(offset);
  355. assertEq(newValue, container.replace_12_10(newValue, offset).extract_12_10(offset));
  356. assertEq(container, container.replace_12_10(newValue, offset).replace_12_10(oldValue, offset));
  357. }
  358. function testSymbolicReplace(bytes16 container, bytes1 newValue, uint8 offset) external pure {
  359. offset = uint8(bound(offset, 0, 15));
  360. bytes1 oldValue = container.extract_16_1(offset);
  361. assertEq(newValue, container.replace_16_1(newValue, offset).extract_16_1(offset));
  362. assertEq(container, container.replace_16_1(newValue, offset).replace_16_1(oldValue, offset));
  363. }
  364. function testSymbolicReplace(bytes16 container, bytes2 newValue, uint8 offset) external pure {
  365. offset = uint8(bound(offset, 0, 14));
  366. bytes2 oldValue = container.extract_16_2(offset);
  367. assertEq(newValue, container.replace_16_2(newValue, offset).extract_16_2(offset));
  368. assertEq(container, container.replace_16_2(newValue, offset).replace_16_2(oldValue, offset));
  369. }
  370. function testSymbolicReplace(bytes16 container, bytes4 newValue, uint8 offset) external pure {
  371. offset = uint8(bound(offset, 0, 12));
  372. bytes4 oldValue = container.extract_16_4(offset);
  373. assertEq(newValue, container.replace_16_4(newValue, offset).extract_16_4(offset));
  374. assertEq(container, container.replace_16_4(newValue, offset).replace_16_4(oldValue, offset));
  375. }
  376. function testSymbolicReplace(bytes16 container, bytes6 newValue, uint8 offset) external pure {
  377. offset = uint8(bound(offset, 0, 10));
  378. bytes6 oldValue = container.extract_16_6(offset);
  379. assertEq(newValue, container.replace_16_6(newValue, offset).extract_16_6(offset));
  380. assertEq(container, container.replace_16_6(newValue, offset).replace_16_6(oldValue, offset));
  381. }
  382. function testSymbolicReplace(bytes16 container, bytes8 newValue, uint8 offset) external pure {
  383. offset = uint8(bound(offset, 0, 8));
  384. bytes8 oldValue = container.extract_16_8(offset);
  385. assertEq(newValue, container.replace_16_8(newValue, offset).extract_16_8(offset));
  386. assertEq(container, container.replace_16_8(newValue, offset).replace_16_8(oldValue, offset));
  387. }
  388. function testSymbolicReplace(bytes16 container, bytes10 newValue, uint8 offset) external pure {
  389. offset = uint8(bound(offset, 0, 6));
  390. bytes10 oldValue = container.extract_16_10(offset);
  391. assertEq(newValue, container.replace_16_10(newValue, offset).extract_16_10(offset));
  392. assertEq(container, container.replace_16_10(newValue, offset).replace_16_10(oldValue, offset));
  393. }
  394. function testSymbolicReplace(bytes16 container, bytes12 newValue, uint8 offset) external pure {
  395. offset = uint8(bound(offset, 0, 4));
  396. bytes12 oldValue = container.extract_16_12(offset);
  397. assertEq(newValue, container.replace_16_12(newValue, offset).extract_16_12(offset));
  398. assertEq(container, container.replace_16_12(newValue, offset).replace_16_12(oldValue, offset));
  399. }
  400. function testSymbolicReplace(bytes20 container, bytes1 newValue, uint8 offset) external pure {
  401. offset = uint8(bound(offset, 0, 19));
  402. bytes1 oldValue = container.extract_20_1(offset);
  403. assertEq(newValue, container.replace_20_1(newValue, offset).extract_20_1(offset));
  404. assertEq(container, container.replace_20_1(newValue, offset).replace_20_1(oldValue, offset));
  405. }
  406. function testSymbolicReplace(bytes20 container, bytes2 newValue, uint8 offset) external pure {
  407. offset = uint8(bound(offset, 0, 18));
  408. bytes2 oldValue = container.extract_20_2(offset);
  409. assertEq(newValue, container.replace_20_2(newValue, offset).extract_20_2(offset));
  410. assertEq(container, container.replace_20_2(newValue, offset).replace_20_2(oldValue, offset));
  411. }
  412. function testSymbolicReplace(bytes20 container, bytes4 newValue, uint8 offset) external pure {
  413. offset = uint8(bound(offset, 0, 16));
  414. bytes4 oldValue = container.extract_20_4(offset);
  415. assertEq(newValue, container.replace_20_4(newValue, offset).extract_20_4(offset));
  416. assertEq(container, container.replace_20_4(newValue, offset).replace_20_4(oldValue, offset));
  417. }
  418. function testSymbolicReplace(bytes20 container, bytes6 newValue, uint8 offset) external pure {
  419. offset = uint8(bound(offset, 0, 14));
  420. bytes6 oldValue = container.extract_20_6(offset);
  421. assertEq(newValue, container.replace_20_6(newValue, offset).extract_20_6(offset));
  422. assertEq(container, container.replace_20_6(newValue, offset).replace_20_6(oldValue, offset));
  423. }
  424. function testSymbolicReplace(bytes20 container, bytes8 newValue, uint8 offset) external pure {
  425. offset = uint8(bound(offset, 0, 12));
  426. bytes8 oldValue = container.extract_20_8(offset);
  427. assertEq(newValue, container.replace_20_8(newValue, offset).extract_20_8(offset));
  428. assertEq(container, container.replace_20_8(newValue, offset).replace_20_8(oldValue, offset));
  429. }
  430. function testSymbolicReplace(bytes20 container, bytes10 newValue, uint8 offset) external pure {
  431. offset = uint8(bound(offset, 0, 10));
  432. bytes10 oldValue = container.extract_20_10(offset);
  433. assertEq(newValue, container.replace_20_10(newValue, offset).extract_20_10(offset));
  434. assertEq(container, container.replace_20_10(newValue, offset).replace_20_10(oldValue, offset));
  435. }
  436. function testSymbolicReplace(bytes20 container, bytes12 newValue, uint8 offset) external pure {
  437. offset = uint8(bound(offset, 0, 8));
  438. bytes12 oldValue = container.extract_20_12(offset);
  439. assertEq(newValue, container.replace_20_12(newValue, offset).extract_20_12(offset));
  440. assertEq(container, container.replace_20_12(newValue, offset).replace_20_12(oldValue, offset));
  441. }
  442. function testSymbolicReplace(bytes20 container, bytes16 newValue, uint8 offset) external pure {
  443. offset = uint8(bound(offset, 0, 4));
  444. bytes16 oldValue = container.extract_20_16(offset);
  445. assertEq(newValue, container.replace_20_16(newValue, offset).extract_20_16(offset));
  446. assertEq(container, container.replace_20_16(newValue, offset).replace_20_16(oldValue, offset));
  447. }
  448. function testSymbolicReplace(bytes22 container, bytes1 newValue, uint8 offset) external pure {
  449. offset = uint8(bound(offset, 0, 21));
  450. bytes1 oldValue = container.extract_22_1(offset);
  451. assertEq(newValue, container.replace_22_1(newValue, offset).extract_22_1(offset));
  452. assertEq(container, container.replace_22_1(newValue, offset).replace_22_1(oldValue, offset));
  453. }
  454. function testSymbolicReplace(bytes22 container, bytes2 newValue, uint8 offset) external pure {
  455. offset = uint8(bound(offset, 0, 20));
  456. bytes2 oldValue = container.extract_22_2(offset);
  457. assertEq(newValue, container.replace_22_2(newValue, offset).extract_22_2(offset));
  458. assertEq(container, container.replace_22_2(newValue, offset).replace_22_2(oldValue, offset));
  459. }
  460. function testSymbolicReplace(bytes22 container, bytes4 newValue, uint8 offset) external pure {
  461. offset = uint8(bound(offset, 0, 18));
  462. bytes4 oldValue = container.extract_22_4(offset);
  463. assertEq(newValue, container.replace_22_4(newValue, offset).extract_22_4(offset));
  464. assertEq(container, container.replace_22_4(newValue, offset).replace_22_4(oldValue, offset));
  465. }
  466. function testSymbolicReplace(bytes22 container, bytes6 newValue, uint8 offset) external pure {
  467. offset = uint8(bound(offset, 0, 16));
  468. bytes6 oldValue = container.extract_22_6(offset);
  469. assertEq(newValue, container.replace_22_6(newValue, offset).extract_22_6(offset));
  470. assertEq(container, container.replace_22_6(newValue, offset).replace_22_6(oldValue, offset));
  471. }
  472. function testSymbolicReplace(bytes22 container, bytes8 newValue, uint8 offset) external pure {
  473. offset = uint8(bound(offset, 0, 14));
  474. bytes8 oldValue = container.extract_22_8(offset);
  475. assertEq(newValue, container.replace_22_8(newValue, offset).extract_22_8(offset));
  476. assertEq(container, container.replace_22_8(newValue, offset).replace_22_8(oldValue, offset));
  477. }
  478. function testSymbolicReplace(bytes22 container, bytes10 newValue, uint8 offset) external pure {
  479. offset = uint8(bound(offset, 0, 12));
  480. bytes10 oldValue = container.extract_22_10(offset);
  481. assertEq(newValue, container.replace_22_10(newValue, offset).extract_22_10(offset));
  482. assertEq(container, container.replace_22_10(newValue, offset).replace_22_10(oldValue, offset));
  483. }
  484. function testSymbolicReplace(bytes22 container, bytes12 newValue, uint8 offset) external pure {
  485. offset = uint8(bound(offset, 0, 10));
  486. bytes12 oldValue = container.extract_22_12(offset);
  487. assertEq(newValue, container.replace_22_12(newValue, offset).extract_22_12(offset));
  488. assertEq(container, container.replace_22_12(newValue, offset).replace_22_12(oldValue, offset));
  489. }
  490. function testSymbolicReplace(bytes22 container, bytes16 newValue, uint8 offset) external pure {
  491. offset = uint8(bound(offset, 0, 6));
  492. bytes16 oldValue = container.extract_22_16(offset);
  493. assertEq(newValue, container.replace_22_16(newValue, offset).extract_22_16(offset));
  494. assertEq(container, container.replace_22_16(newValue, offset).replace_22_16(oldValue, offset));
  495. }
  496. function testSymbolicReplace(bytes22 container, bytes20 newValue, uint8 offset) external pure {
  497. offset = uint8(bound(offset, 0, 2));
  498. bytes20 oldValue = container.extract_22_20(offset);
  499. assertEq(newValue, container.replace_22_20(newValue, offset).extract_22_20(offset));
  500. assertEq(container, container.replace_22_20(newValue, offset).replace_22_20(oldValue, offset));
  501. }
  502. function testSymbolicReplace(bytes24 container, bytes1 newValue, uint8 offset) external pure {
  503. offset = uint8(bound(offset, 0, 23));
  504. bytes1 oldValue = container.extract_24_1(offset);
  505. assertEq(newValue, container.replace_24_1(newValue, offset).extract_24_1(offset));
  506. assertEq(container, container.replace_24_1(newValue, offset).replace_24_1(oldValue, offset));
  507. }
  508. function testSymbolicReplace(bytes24 container, bytes2 newValue, uint8 offset) external pure {
  509. offset = uint8(bound(offset, 0, 22));
  510. bytes2 oldValue = container.extract_24_2(offset);
  511. assertEq(newValue, container.replace_24_2(newValue, offset).extract_24_2(offset));
  512. assertEq(container, container.replace_24_2(newValue, offset).replace_24_2(oldValue, offset));
  513. }
  514. function testSymbolicReplace(bytes24 container, bytes4 newValue, uint8 offset) external pure {
  515. offset = uint8(bound(offset, 0, 20));
  516. bytes4 oldValue = container.extract_24_4(offset);
  517. assertEq(newValue, container.replace_24_4(newValue, offset).extract_24_4(offset));
  518. assertEq(container, container.replace_24_4(newValue, offset).replace_24_4(oldValue, offset));
  519. }
  520. function testSymbolicReplace(bytes24 container, bytes6 newValue, uint8 offset) external pure {
  521. offset = uint8(bound(offset, 0, 18));
  522. bytes6 oldValue = container.extract_24_6(offset);
  523. assertEq(newValue, container.replace_24_6(newValue, offset).extract_24_6(offset));
  524. assertEq(container, container.replace_24_6(newValue, offset).replace_24_6(oldValue, offset));
  525. }
  526. function testSymbolicReplace(bytes24 container, bytes8 newValue, uint8 offset) external pure {
  527. offset = uint8(bound(offset, 0, 16));
  528. bytes8 oldValue = container.extract_24_8(offset);
  529. assertEq(newValue, container.replace_24_8(newValue, offset).extract_24_8(offset));
  530. assertEq(container, container.replace_24_8(newValue, offset).replace_24_8(oldValue, offset));
  531. }
  532. function testSymbolicReplace(bytes24 container, bytes10 newValue, uint8 offset) external pure {
  533. offset = uint8(bound(offset, 0, 14));
  534. bytes10 oldValue = container.extract_24_10(offset);
  535. assertEq(newValue, container.replace_24_10(newValue, offset).extract_24_10(offset));
  536. assertEq(container, container.replace_24_10(newValue, offset).replace_24_10(oldValue, offset));
  537. }
  538. function testSymbolicReplace(bytes24 container, bytes12 newValue, uint8 offset) external pure {
  539. offset = uint8(bound(offset, 0, 12));
  540. bytes12 oldValue = container.extract_24_12(offset);
  541. assertEq(newValue, container.replace_24_12(newValue, offset).extract_24_12(offset));
  542. assertEq(container, container.replace_24_12(newValue, offset).replace_24_12(oldValue, offset));
  543. }
  544. function testSymbolicReplace(bytes24 container, bytes16 newValue, uint8 offset) external pure {
  545. offset = uint8(bound(offset, 0, 8));
  546. bytes16 oldValue = container.extract_24_16(offset);
  547. assertEq(newValue, container.replace_24_16(newValue, offset).extract_24_16(offset));
  548. assertEq(container, container.replace_24_16(newValue, offset).replace_24_16(oldValue, offset));
  549. }
  550. function testSymbolicReplace(bytes24 container, bytes20 newValue, uint8 offset) external pure {
  551. offset = uint8(bound(offset, 0, 4));
  552. bytes20 oldValue = container.extract_24_20(offset);
  553. assertEq(newValue, container.replace_24_20(newValue, offset).extract_24_20(offset));
  554. assertEq(container, container.replace_24_20(newValue, offset).replace_24_20(oldValue, offset));
  555. }
  556. function testSymbolicReplace(bytes24 container, bytes22 newValue, uint8 offset) external pure {
  557. offset = uint8(bound(offset, 0, 2));
  558. bytes22 oldValue = container.extract_24_22(offset);
  559. assertEq(newValue, container.replace_24_22(newValue, offset).extract_24_22(offset));
  560. assertEq(container, container.replace_24_22(newValue, offset).replace_24_22(oldValue, offset));
  561. }
  562. function testSymbolicReplace(bytes28 container, bytes1 newValue, uint8 offset) external pure {
  563. offset = uint8(bound(offset, 0, 27));
  564. bytes1 oldValue = container.extract_28_1(offset);
  565. assertEq(newValue, container.replace_28_1(newValue, offset).extract_28_1(offset));
  566. assertEq(container, container.replace_28_1(newValue, offset).replace_28_1(oldValue, offset));
  567. }
  568. function testSymbolicReplace(bytes28 container, bytes2 newValue, uint8 offset) external pure {
  569. offset = uint8(bound(offset, 0, 26));
  570. bytes2 oldValue = container.extract_28_2(offset);
  571. assertEq(newValue, container.replace_28_2(newValue, offset).extract_28_2(offset));
  572. assertEq(container, container.replace_28_2(newValue, offset).replace_28_2(oldValue, offset));
  573. }
  574. function testSymbolicReplace(bytes28 container, bytes4 newValue, uint8 offset) external pure {
  575. offset = uint8(bound(offset, 0, 24));
  576. bytes4 oldValue = container.extract_28_4(offset);
  577. assertEq(newValue, container.replace_28_4(newValue, offset).extract_28_4(offset));
  578. assertEq(container, container.replace_28_4(newValue, offset).replace_28_4(oldValue, offset));
  579. }
  580. function testSymbolicReplace(bytes28 container, bytes6 newValue, uint8 offset) external pure {
  581. offset = uint8(bound(offset, 0, 22));
  582. bytes6 oldValue = container.extract_28_6(offset);
  583. assertEq(newValue, container.replace_28_6(newValue, offset).extract_28_6(offset));
  584. assertEq(container, container.replace_28_6(newValue, offset).replace_28_6(oldValue, offset));
  585. }
  586. function testSymbolicReplace(bytes28 container, bytes8 newValue, uint8 offset) external pure {
  587. offset = uint8(bound(offset, 0, 20));
  588. bytes8 oldValue = container.extract_28_8(offset);
  589. assertEq(newValue, container.replace_28_8(newValue, offset).extract_28_8(offset));
  590. assertEq(container, container.replace_28_8(newValue, offset).replace_28_8(oldValue, offset));
  591. }
  592. function testSymbolicReplace(bytes28 container, bytes10 newValue, uint8 offset) external pure {
  593. offset = uint8(bound(offset, 0, 18));
  594. bytes10 oldValue = container.extract_28_10(offset);
  595. assertEq(newValue, container.replace_28_10(newValue, offset).extract_28_10(offset));
  596. assertEq(container, container.replace_28_10(newValue, offset).replace_28_10(oldValue, offset));
  597. }
  598. function testSymbolicReplace(bytes28 container, bytes12 newValue, uint8 offset) external pure {
  599. offset = uint8(bound(offset, 0, 16));
  600. bytes12 oldValue = container.extract_28_12(offset);
  601. assertEq(newValue, container.replace_28_12(newValue, offset).extract_28_12(offset));
  602. assertEq(container, container.replace_28_12(newValue, offset).replace_28_12(oldValue, offset));
  603. }
  604. function testSymbolicReplace(bytes28 container, bytes16 newValue, uint8 offset) external pure {
  605. offset = uint8(bound(offset, 0, 12));
  606. bytes16 oldValue = container.extract_28_16(offset);
  607. assertEq(newValue, container.replace_28_16(newValue, offset).extract_28_16(offset));
  608. assertEq(container, container.replace_28_16(newValue, offset).replace_28_16(oldValue, offset));
  609. }
  610. function testSymbolicReplace(bytes28 container, bytes20 newValue, uint8 offset) external pure {
  611. offset = uint8(bound(offset, 0, 8));
  612. bytes20 oldValue = container.extract_28_20(offset);
  613. assertEq(newValue, container.replace_28_20(newValue, offset).extract_28_20(offset));
  614. assertEq(container, container.replace_28_20(newValue, offset).replace_28_20(oldValue, offset));
  615. }
  616. function testSymbolicReplace(bytes28 container, bytes22 newValue, uint8 offset) external pure {
  617. offset = uint8(bound(offset, 0, 6));
  618. bytes22 oldValue = container.extract_28_22(offset);
  619. assertEq(newValue, container.replace_28_22(newValue, offset).extract_28_22(offset));
  620. assertEq(container, container.replace_28_22(newValue, offset).replace_28_22(oldValue, offset));
  621. }
  622. function testSymbolicReplace(bytes28 container, bytes24 newValue, uint8 offset) external pure {
  623. offset = uint8(bound(offset, 0, 4));
  624. bytes24 oldValue = container.extract_28_24(offset);
  625. assertEq(newValue, container.replace_28_24(newValue, offset).extract_28_24(offset));
  626. assertEq(container, container.replace_28_24(newValue, offset).replace_28_24(oldValue, offset));
  627. }
  628. function testSymbolicReplace(bytes32 container, bytes1 newValue, uint8 offset) external pure {
  629. offset = uint8(bound(offset, 0, 31));
  630. bytes1 oldValue = container.extract_32_1(offset);
  631. assertEq(newValue, container.replace_32_1(newValue, offset).extract_32_1(offset));
  632. assertEq(container, container.replace_32_1(newValue, offset).replace_32_1(oldValue, offset));
  633. }
  634. function testSymbolicReplace(bytes32 container, bytes2 newValue, uint8 offset) external pure {
  635. offset = uint8(bound(offset, 0, 30));
  636. bytes2 oldValue = container.extract_32_2(offset);
  637. assertEq(newValue, container.replace_32_2(newValue, offset).extract_32_2(offset));
  638. assertEq(container, container.replace_32_2(newValue, offset).replace_32_2(oldValue, offset));
  639. }
  640. function testSymbolicReplace(bytes32 container, bytes4 newValue, uint8 offset) external pure {
  641. offset = uint8(bound(offset, 0, 28));
  642. bytes4 oldValue = container.extract_32_4(offset);
  643. assertEq(newValue, container.replace_32_4(newValue, offset).extract_32_4(offset));
  644. assertEq(container, container.replace_32_4(newValue, offset).replace_32_4(oldValue, offset));
  645. }
  646. function testSymbolicReplace(bytes32 container, bytes6 newValue, uint8 offset) external pure {
  647. offset = uint8(bound(offset, 0, 26));
  648. bytes6 oldValue = container.extract_32_6(offset);
  649. assertEq(newValue, container.replace_32_6(newValue, offset).extract_32_6(offset));
  650. assertEq(container, container.replace_32_6(newValue, offset).replace_32_6(oldValue, offset));
  651. }
  652. function testSymbolicReplace(bytes32 container, bytes8 newValue, uint8 offset) external pure {
  653. offset = uint8(bound(offset, 0, 24));
  654. bytes8 oldValue = container.extract_32_8(offset);
  655. assertEq(newValue, container.replace_32_8(newValue, offset).extract_32_8(offset));
  656. assertEq(container, container.replace_32_8(newValue, offset).replace_32_8(oldValue, offset));
  657. }
  658. function testSymbolicReplace(bytes32 container, bytes10 newValue, uint8 offset) external pure {
  659. offset = uint8(bound(offset, 0, 22));
  660. bytes10 oldValue = container.extract_32_10(offset);
  661. assertEq(newValue, container.replace_32_10(newValue, offset).extract_32_10(offset));
  662. assertEq(container, container.replace_32_10(newValue, offset).replace_32_10(oldValue, offset));
  663. }
  664. function testSymbolicReplace(bytes32 container, bytes12 newValue, uint8 offset) external pure {
  665. offset = uint8(bound(offset, 0, 20));
  666. bytes12 oldValue = container.extract_32_12(offset);
  667. assertEq(newValue, container.replace_32_12(newValue, offset).extract_32_12(offset));
  668. assertEq(container, container.replace_32_12(newValue, offset).replace_32_12(oldValue, offset));
  669. }
  670. function testSymbolicReplace(bytes32 container, bytes16 newValue, uint8 offset) external pure {
  671. offset = uint8(bound(offset, 0, 16));
  672. bytes16 oldValue = container.extract_32_16(offset);
  673. assertEq(newValue, container.replace_32_16(newValue, offset).extract_32_16(offset));
  674. assertEq(container, container.replace_32_16(newValue, offset).replace_32_16(oldValue, offset));
  675. }
  676. function testSymbolicReplace(bytes32 container, bytes20 newValue, uint8 offset) external pure {
  677. offset = uint8(bound(offset, 0, 12));
  678. bytes20 oldValue = container.extract_32_20(offset);
  679. assertEq(newValue, container.replace_32_20(newValue, offset).extract_32_20(offset));
  680. assertEq(container, container.replace_32_20(newValue, offset).replace_32_20(oldValue, offset));
  681. }
  682. function testSymbolicReplace(bytes32 container, bytes22 newValue, uint8 offset) external pure {
  683. offset = uint8(bound(offset, 0, 10));
  684. bytes22 oldValue = container.extract_32_22(offset);
  685. assertEq(newValue, container.replace_32_22(newValue, offset).extract_32_22(offset));
  686. assertEq(container, container.replace_32_22(newValue, offset).replace_32_22(oldValue, offset));
  687. }
  688. function testSymbolicReplace(bytes32 container, bytes24 newValue, uint8 offset) external pure {
  689. offset = uint8(bound(offset, 0, 8));
  690. bytes24 oldValue = container.extract_32_24(offset);
  691. assertEq(newValue, container.replace_32_24(newValue, offset).extract_32_24(offset));
  692. assertEq(container, container.replace_32_24(newValue, offset).replace_32_24(oldValue, offset));
  693. }
  694. function testSymbolicReplace(bytes32 container, bytes28 newValue, uint8 offset) external pure {
  695. offset = uint8(bound(offset, 0, 4));
  696. bytes28 oldValue = container.extract_32_28(offset);
  697. assertEq(newValue, container.replace_32_28(newValue, offset).extract_32_28(offset));
  698. assertEq(container, container.replace_32_28(newValue, offset).replace_32_28(oldValue, offset));
  699. }
  700. }