1
0

tests.inc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. /*
  2. Legal:
  3. Version: MPL 1.1
  4. The contents of this file are subject to the Mozilla Public License Version
  5. 1.1 the "License"; you may not use this file except in compliance with
  6. the License. You may obtain a copy of the License at
  7. http://www.mozilla.org/MPL/
  8. Software distributed under the License is distributed on an "AS IS" basis,
  9. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  10. for the specific language governing rights and limitations under the
  11. License.
  12. The Original Code is the YSI framework.
  13. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  14. Portions created by the Initial Developer are Copyright C 2011
  15. the Initial Developer. All Rights Reserved.
  16. Contributors:
  17. Y_Less
  18. koolk
  19. JoeBullet/Google63
  20. g_aSlice/Slice
  21. Misiur
  22. samphunter
  23. tianmeta
  24. maddinat0r
  25. spacemud
  26. Crayder
  27. Dayvison
  28. Ahmad45123
  29. Zeex
  30. irinel1996
  31. Yiin-
  32. Chaprnks
  33. Konstantinos
  34. Masterchen09
  35. Southclaws
  36. PatchwerkQWER
  37. m0k1
  38. paulommu
  39. udan111
  40. Thanks:
  41. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  42. ZeeX - Very productive conversations.
  43. koolk - IsPlayerinAreaEx code.
  44. TheAlpha - Danish translation.
  45. breadfish - German translation.
  46. Fireburn - Dutch translation.
  47. yom - French translation.
  48. 50p - Polish translation.
  49. Zamaroht - Spanish translation.
  50. Los - Portuguese translation.
  51. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  52. me to strive to better.
  53. Pixels^ - Running XScripters where the idea was born.
  54. Matite - Pestering me to release it and using it.
  55. Very special thanks to:
  56. Thiadmer - PAWN, whose limits continue to amaze me!
  57. Kye/Kalcor - SA:MP.
  58. SA:MP Team past, present and future - SA:MP.
  59. Optional plugins:
  60. Gamer_Z - GPS.
  61. Incognito - Streamer.
  62. Me - sscanf2, fixes2, Whirlpool.
  63. */
  64. Test:y_stringhash__Empty()
  65. {
  66. new
  67. h0 = _H@b<>,
  68. h1 = _H@f<>,
  69. h2 = _H@a<>;
  70. ASSERT(h0 == -1);
  71. ASSERT(h1 == 2166136261);
  72. ASSERT(h2 == 2166136261);
  73. h1 = _H@b(),
  74. h2 = _H@f(),
  75. h0 = _H@a();
  76. ASSERT(h1 == -1);
  77. ASSERT(h2 == 2166136261);
  78. ASSERT(h0 == 2166136261);
  79. h2 = YHash("", .type = hash_bernstein),
  80. h0 = YHash("", .type = hash_fnv1),
  81. h1 = YHash("", .type = hash_fnv1a);
  82. ASSERT(h2 == -1);
  83. ASSERT(h0 == 2166136261);
  84. ASSERT(h1 == 2166136261);
  85. h2 = _H<>,
  86. h0 = _H();
  87. ASSERT(h2 == -1);
  88. ASSERT(h0 == -1);
  89. }
  90. Test:y_stringhash__Chars0()
  91. {
  92. new
  93. hh;
  94. hh = _H<aabbccddeeff>;
  95. ASSERT(hh == YHash("aabbccddeeff", .type = hash_bernstein));
  96. hh = _H<gghhiijjkkll>;
  97. ASSERT(hh == YHash("gghhiijjkkll", .type = hash_bernstein));
  98. hh = _H<mmnnooppqqrr>;
  99. ASSERT(hh == YHash("mmnnooppqqrr", .type = hash_bernstein));
  100. hh = _H<ssttuuvvwwxx>;
  101. ASSERT(hh == YHash("ssttuuvvwwxx", .type = hash_bernstein));
  102. hh = _H<yyzz00112233>;
  103. ASSERT(hh == YHash("yyzz00112233", .type = hash_bernstein));
  104. hh = _H<445566778899>;
  105. ASSERT(hh == YHash("445566778899", .type = hash_bernstein));
  106. hh = _H<AABBCCDDEEFF>;
  107. ASSERT(hh == YHash("AABBCCDDEEFF", .type = hash_bernstein));
  108. hh = _H<GGHHIIJJKKLL>;
  109. ASSERT(hh == YHash("GGHHIIJJKKLL", .type = hash_bernstein));
  110. hh = _H<MMNNOOPPQQRR>;
  111. ASSERT(hh == YHash("MMNNOOPPQQRR", .type = hash_bernstein));
  112. hh = _H<SSTTUUVVWWXX>;
  113. ASSERT(hh == YHash("SSTTUUVVWWXX", .type = hash_bernstein));
  114. hh = _H<YYZZ @@__yh>;
  115. ASSERT(hh == YHash("YYZZ @@__yh", .type = hash_bernstein));
  116. hh = _I<aabbccddeeff>;
  117. ASSERT(hh == YHash("aabbccddeeff", .sensitive = false, .type = hash_bernstein));
  118. hh = _I<gghhiijjkkll>;
  119. ASSERT(hh == YHash("gghhiijjkkll", .sensitive = false, .type = hash_bernstein));
  120. hh = _I<mmnnooppqqrr>;
  121. ASSERT(hh == YHash("mmnnooppqqrr", .sensitive = false, .type = hash_bernstein));
  122. hh = _I<ssttuuvvwwxx>;
  123. ASSERT(hh == YHash("ssttuuvvwwxx", .sensitive = false, .type = hash_bernstein));
  124. hh = _I<yyzz00112233>;
  125. ASSERT(hh == YHash("yyzz00112233", .sensitive = false, .type = hash_bernstein));
  126. hh = _I<445566778899>;
  127. ASSERT(hh == YHash("445566778899", .sensitive = false, .type = hash_bernstein));
  128. hh = _I<AABBCCDDEEFF>;
  129. ASSERT(hh == YHash("AABBCCDDEEFF", .sensitive = false, .type = hash_bernstein));
  130. hh = _I<GGHHIIJJKKLL>;
  131. ASSERT(hh == YHash("GGHHIIJJKKLL", .sensitive = false, .type = hash_bernstein));
  132. hh = _I<MMNNOOPPQQRR>;
  133. ASSERT(hh == YHash("MMNNOOPPQQRR", .sensitive = false, .type = hash_bernstein));
  134. hh = _I<SSTTUUVVWWXX>;
  135. ASSERT(hh == YHash("SSTTUUVVWWXX", .sensitive = false, .type = hash_bernstein));
  136. hh = _I<YYZZ @@__yh>;
  137. ASSERT(hh == YHash("YYZZ @@__yh", .sensitive = false, .type = hash_bernstein));
  138. }
  139. Test:y_stringhash__Chars1()
  140. {
  141. new
  142. hh;
  143. hh = _H@f<aabbccddeeff>;
  144. ASSERT(hh == YHash("aabbccddeeff", .type = hash_fnv1));
  145. hh = _H@f<gghhiijjkkll>;
  146. ASSERT(hh == YHash("gghhiijjkkll", .type = hash_fnv1));
  147. hh = _H@f<mmnnooppqqrr>;
  148. ASSERT(hh == YHash("mmnnooppqqrr", .type = hash_fnv1));
  149. hh = _H@f<ssttuuvvwwxx>;
  150. ASSERT(hh == YHash("ssttuuvvwwxx", .type = hash_fnv1));
  151. hh = _H@f<yyzz00112233>;
  152. ASSERT(hh == YHash("yyzz00112233", .type = hash_fnv1));
  153. hh = _H@f<445566778899>;
  154. ASSERT(hh == YHash("445566778899", .type = hash_fnv1));
  155. hh = _H@f<AABBCCDDEEFF>;
  156. ASSERT(hh == YHash("AABBCCDDEEFF", .type = hash_fnv1));
  157. hh = _H@f<GGHHIIJJKKLL>;
  158. ASSERT(hh == YHash("GGHHIIJJKKLL", .type = hash_fnv1));
  159. hh = _H@f<MMNNOOPPQQRR>;
  160. ASSERT(hh == YHash("MMNNOOPPQQRR", .type = hash_fnv1));
  161. hh = _H@f<SSTTUUVVWWXX>;
  162. ASSERT(hh == YHash("SSTTUUVVWWXX", .type = hash_fnv1));
  163. hh = _H@f<YYZZ @@__yh>;
  164. ASSERT(hh == YHash("YYZZ @@__yh", .type = hash_fnv1));
  165. hh = _I@f<aabbccddeeff>;
  166. ASSERT(hh == YHash("aabbccddeeff", .sensitive = false, .type = hash_fnv1));
  167. hh = _I@f<gghhiijjkkll>;
  168. ASSERT(hh == YHash("gghhiijjkkll", .sensitive = false, .type = hash_fnv1));
  169. hh = _I@f<mmnnooppqqrr>;
  170. ASSERT(hh == YHash("mmnnooppqqrr", .sensitive = false, .type = hash_fnv1));
  171. hh = _I@f<ssttuuvvwwxx>;
  172. ASSERT(hh == YHash("ssttuuvvwwxx", .sensitive = false, .type = hash_fnv1));
  173. hh = _I@f<yyzz00112233>;
  174. ASSERT(hh == YHash("yyzz00112233", .sensitive = false, .type = hash_fnv1));
  175. hh = _I@f<445566778899>;
  176. ASSERT(hh == YHash("445566778899", .sensitive = false, .type = hash_fnv1));
  177. hh = _I@f<AABBCCDDEEFF>;
  178. ASSERT(hh == YHash("AABBCCDDEEFF", .sensitive = false, .type = hash_fnv1));
  179. hh = _I@f<GGHHIIJJKKLL>;
  180. ASSERT(hh == YHash("GGHHIIJJKKLL", .sensitive = false, .type = hash_fnv1));
  181. hh = _I@f<MMNNOOPPQQRR>;
  182. ASSERT(hh == YHash("MMNNOOPPQQRR", .sensitive = false, .type = hash_fnv1));
  183. hh = _I@f<SSTTUUVVWWXX>;
  184. ASSERT(hh == YHash("SSTTUUVVWWXX", .sensitive = false, .type = hash_fnv1));
  185. hh = _I@f<YYZZ @@__yh>;
  186. ASSERT(hh == YHash("YYZZ @@__yh", .sensitive = false, .type = hash_fnv1));
  187. }
  188. Test:y_stringhash__Chars2()
  189. {
  190. new
  191. hh;
  192. hh = _H@a<aabbccddeeff>;
  193. ASSERT(hh == YHash("aabbccddeeff", .type = hash_fnv1a));
  194. hh = _H@a<gghhiijjkkll>;
  195. ASSERT(hh == YHash("gghhiijjkkll", .type = hash_fnv1a));
  196. hh = _H@a<mmnnooppqqrr>;
  197. ASSERT(hh == YHash("mmnnooppqqrr", .type = hash_fnv1a));
  198. hh = _H@a<ssttuuvvwwxx>;
  199. ASSERT(hh == YHash("ssttuuvvwwxx", .type = hash_fnv1a));
  200. hh = _H@a<yyzz00112233>;
  201. ASSERT(hh == YHash("yyzz00112233", .type = hash_fnv1a));
  202. hh = _H@a<445566778899>;
  203. ASSERT(hh == YHash("445566778899", .type = hash_fnv1a));
  204. hh = _H@a<AABBCCDDEEFF>;
  205. ASSERT(hh == YHash("AABBCCDDEEFF", .type = hash_fnv1a));
  206. hh = _H@a<GGHHIIJJKKLL>;
  207. ASSERT(hh == YHash("GGHHIIJJKKLL", .type = hash_fnv1a));
  208. hh = _H@a<MMNNOOPPQQRR>;
  209. ASSERT(hh == YHash("MMNNOOPPQQRR", .type = hash_fnv1a));
  210. hh = _H@a<SSTTUUVVWWXX>;
  211. ASSERT(hh == YHash("SSTTUUVVWWXX", .type = hash_fnv1a));
  212. hh = _H@a<YYZZ @@__yh>;
  213. ASSERT(hh == YHash("YYZZ @@__yh", .type = hash_fnv1a));
  214. hh = _I@a<aabbccddeeff>;
  215. ASSERT(hh == YHash("aabbccddeeff", .sensitive = false, .type = hash_fnv1a));
  216. hh = _I@a<gghhiijjkkll>;
  217. ASSERT(hh == YHash("gghhiijjkkll", .sensitive = false, .type = hash_fnv1a));
  218. hh = _I@a<mmnnooppqqrr>;
  219. ASSERT(hh == YHash("mmnnooppqqrr", .sensitive = false, .type = hash_fnv1a));
  220. hh = _I@a<ssttuuvvwwxx>;
  221. ASSERT(hh == YHash("ssttuuvvwwxx", .sensitive = false, .type = hash_fnv1a));
  222. hh = _I@a<yyzz00112233>;
  223. ASSERT(hh == YHash("yyzz00112233", .sensitive = false, .type = hash_fnv1a));
  224. hh = _I@a<445566778899>;
  225. ASSERT(hh == YHash("445566778899", .sensitive = false, .type = hash_fnv1a));
  226. hh = _I@a<AABBCCDDEEFF>;
  227. ASSERT(hh == YHash("AABBCCDDEEFF", .sensitive = false, .type = hash_fnv1a));
  228. hh = _I@a<GGHHIIJJKKLL>;
  229. ASSERT(hh == YHash("GGHHIIJJKKLL", .sensitive = false, .type = hash_fnv1a));
  230. hh = _I@a<MMNNOOPPQQRR>;
  231. ASSERT(hh == YHash("MMNNOOPPQQRR", .sensitive = false, .type = hash_fnv1a));
  232. hh = _I@a<SSTTUUVVWWXX>;
  233. ASSERT(hh == YHash("SSTTUUVVWWXX", .sensitive = false, .type = hash_fnv1a));
  234. hh = _I@a<YYZZ @@__yh>;
  235. ASSERT(hh == YHash("YYZZ @@__yh", .sensitive = false, .type = hash_fnv1a));
  236. }
  237. Test:y_stringhash__case()
  238. {
  239. new
  240. h0,
  241. h1;
  242. h0 = _H<HEllO>;
  243. h1 = _H<HELLO>;
  244. ASSERT(h0 != h1);
  245. h0 = _I<HEllO>;
  246. h1 = _I<HELLO>;
  247. ASSERT(h0 == h1);
  248. h0 = _H@b<heLLo>;
  249. h1 = _H@b<HELLO>;
  250. ASSERT(h0 != h1);
  251. h0 = _I@b<heLLo>;
  252. h1 = _I@b<HELLO>;
  253. ASSERT(h0 == h1);
  254. h0 = _H@f<hello>;
  255. h1 = _H@f<HELLO>;
  256. ASSERT(h0 != h1);
  257. h0 = _I@f<hello>;
  258. h1 = _I@f<HELLO>;
  259. ASSERT(h0 == h1);
  260. h0 = _H@a<hElLo>;
  261. h1 = _H@a<HELLO>;
  262. ASSERT(h0 != h1);
  263. h0 = _I@a<hElLo>;
  264. h1 = _I@a<HELLO>;
  265. ASSERT(h0 == h1);
  266. }
  267. Test:y_stringhash__H1()
  268. {
  269. new
  270. h0 = _H<hello>,
  271. h1 = _H<there>;
  272. ASSERT(h0 != h1);
  273. }
  274. Test:y_stringhash__I1()
  275. {
  276. new
  277. h0 = _I<hello>,
  278. h1 = _I<HelLo>;
  279. ASSERT(h0 == h1);
  280. }
  281. Test:y_stringhash__H2()
  282. {
  283. new
  284. h0 = _H(h,e,l,l,o),
  285. h1 = _H(t,h,e,r,e);
  286. ASSERT(h0 != h1);
  287. }
  288. Test:y_stringhash__I2()
  289. {
  290. new
  291. h0 = _I(h,e,l,l,o),
  292. h1 = _I(H,E,L,L,O);
  293. ASSERT(h0 == h1);
  294. }
  295. Test:y_stringhash__H3()
  296. {
  297. new
  298. h0 = _H@b<hello>,
  299. h1 = _H@b<there>;
  300. ASSERT(h0 != h1);
  301. }
  302. Test:y_stringhash__I3()
  303. {
  304. new
  305. h0 = _I@b<hello>,
  306. h1 = _I@b<HelLo>;
  307. ASSERT(h0 == h1);
  308. }
  309. Test:y_stringhash__H4()
  310. {
  311. new
  312. h0 = _H@b(h,e,l,l,o),
  313. h1 = _H@b(t,h,e,r,e);
  314. ASSERT(h0 != h1);
  315. }
  316. Test:y_stringhash__I4()
  317. {
  318. new
  319. h0 = _I@b(h,e,l,l,o),
  320. h1 = _I@b(H,E,L,L,O);
  321. ASSERT(h0 == h1);
  322. }
  323. Test:y_stringhash__H5()
  324. {
  325. new
  326. h0 = _H@f<hello>,
  327. h1 = _H@f<there>;
  328. ASSERT(h0 != h1);
  329. }
  330. Test:y_stringhash__I5()
  331. {
  332. new
  333. h0 = _I@f<hello>,
  334. h1 = _I@f<HelLo>;
  335. ASSERT(h0 == h1);
  336. }
  337. Test:y_stringhash__H6()
  338. {
  339. new
  340. h0 = _H@f(h,e,l,l,o),
  341. h1 = _H@f(t,h,e,r,e);
  342. ASSERT(h0 != h1);
  343. }
  344. Test:y_stringhash__I6()
  345. {
  346. new
  347. h0 = _I@f(h,e,l,l,o),
  348. h1 = _I@f(H,E,L,L,O);
  349. ASSERT(h0 == h1);
  350. }
  351. Test:y_stringhash__H7()
  352. {
  353. new
  354. h0 = _H@a<hello>,
  355. h1 = _H@a<there>;
  356. ASSERT(h0 != h1);
  357. }
  358. Test:y_stringhash__I7()
  359. {
  360. new
  361. h0 = _I@a<hello>,
  362. h1 = _I@a<HelLo>;
  363. ASSERT(h0 == h1);
  364. }
  365. Test:y_stringhash__H8()
  366. {
  367. new
  368. h0 = _H@a(h,e,l,l,o),
  369. h1 = _H@a(t,h,e,r,e);
  370. ASSERT(h0 != h1);
  371. }
  372. Test:y_stringhash__I8()
  373. {
  374. new
  375. h0 = _I@a(h,e,l,l,o),
  376. h1 = _I@a(H,E,L,L,O);
  377. ASSERT(h0 == h1);
  378. }
  379. Test:y_stringhash__H3e()
  380. {
  381. new
  382. h0 = _H@b<hello>,
  383. h1 = YHash("hello", .type = hash_bernstein);
  384. ASSERT(h0 == h1);
  385. }
  386. Test:y_stringhash__I3e()
  387. {
  388. new
  389. h0 = _I@b<hello>,
  390. h1 = YHash("hello", .type = hash_bernstein, .sensitive = false);
  391. //printf("%04x%04x %04x%04x", h0 >>> 16, h0 & 0xFFFF, h1 >>> 16, h1 & 0xFFFF);
  392. ASSERT(h0 == h1);
  393. }
  394. Test:y_stringhash__H4e()
  395. {
  396. new
  397. h0 = _H@b(h,e,l,l,o),
  398. h1 = YHash("hello", .type = hash_bernstein);
  399. ASSERT(h0 == h1);
  400. }
  401. Test:y_stringhash__I4e()
  402. {
  403. new
  404. h0 = _I@b(h,e,l,l,o),
  405. h1 = YHash("hello", .type = hash_bernstein, .sensitive = false);
  406. ASSERT(h0 == h1);
  407. }
  408. Test:y_stringhash__H5e()
  409. {
  410. new
  411. h0 = _H@f<hello>,
  412. h1 = YHash("hello", .type = hash_fnv1);
  413. ASSERT(h0 == h1);
  414. }
  415. Test:y_stringhash__I5e()
  416. {
  417. new
  418. h0 = _I@f<hello>,
  419. h1 = YHash("hello", .type = hash_fnv1, .sensitive = false);
  420. ASSERT(h0 == h1);
  421. }
  422. Test:y_stringhash__H6e()
  423. {
  424. new
  425. h0 = _H@f(h,e,l,l,o),
  426. h1 = YHash("hello", .type = hash_fnv1);
  427. ASSERT(h0 == h1);
  428. }
  429. Test:y_stringhash__I6e()
  430. {
  431. new
  432. h0 = _I@f(h,e,l,l,o),
  433. h1 = YHash("hello", .type = hash_fnv1, .sensitive = false);
  434. ASSERT(h0 == h1);
  435. }
  436. Test:y_stringhash__H7e()
  437. {
  438. new
  439. h0 = _H@a<hello>,
  440. h1 = YHash("hello", .type = hash_fnv1a);
  441. ASSERT(h0 == h1);
  442. }
  443. Test:y_stringhash__I7e()
  444. {
  445. new
  446. h0 = _I@a<hello>,
  447. h1 = YHash("hello", .type = hash_fnv1a, .sensitive = false);
  448. ASSERT(h0 == h1);
  449. }
  450. Test:y_stringhash__H8e()
  451. {
  452. new
  453. h0 = _H@a(h,e,l,l,o),
  454. h1 = YHash("hello", .type = hash_fnv1a);
  455. ASSERT(h0 == h1);
  456. }
  457. Test:y_stringhash__I8e()
  458. {
  459. new
  460. h0 = _I@a(h,e,l,l,o),
  461. h1 = YHash("hello", .type = hash_fnv1a, .sensitive = false);
  462. ASSERT(h0 == h1);
  463. }
  464. Test:y_stringhash__H3d()
  465. {
  466. new
  467. h0 = HASH:bernstein<hello>,
  468. h1 = YHash("hello", .type = hash_bernstein);
  469. ASSERT(h0 == h1);
  470. }
  471. Test:y_stringhash__I3d()
  472. {
  473. new
  474. h0 = HASHi:bernstein<hello>,
  475. h1 = YHash("hello", .type = hash_bernstein, .sensitive = false);
  476. ASSERT(h0 == h1);
  477. }
  478. Test:y_stringhash__H4d()
  479. {
  480. new
  481. h0 = HASH(bernstein,h,e,l,l,o),
  482. h1 = YHash("hello", .type = hash_bernstein);
  483. ASSERT(h0 == h1);
  484. }
  485. Test:y_stringhash__I4d()
  486. {
  487. new
  488. h0 = HASHi(bernstein,h,e,l,l,o),
  489. h1 = YHash("hello", .type = hash_bernstein, .sensitive = false);
  490. ASSERT(h0 == h1);
  491. }
  492. Test:y_stringhash__H5d()
  493. {
  494. new
  495. h0 = HASH:fnv1<hello>,
  496. h1 = YHash("hello", .type = hash_fnv1);
  497. ASSERT(h0 == h1);
  498. }
  499. Test:y_stringhash__I5d()
  500. {
  501. new
  502. h0 = HASHi:fnv1<hello>,
  503. h1 = YHash("hello", .type = hash_fnv1, .sensitive = false);
  504. ASSERT(h0 == h1);
  505. }
  506. Test:y_stringhash__H6d()
  507. {
  508. new
  509. h0 = HASH(fnv1,h,e,l,l,o),
  510. h1 = YHash("hello", .type = hash_fnv1);
  511. ASSERT(h0 == h1);
  512. }
  513. Test:y_stringhash__I6d()
  514. {
  515. new
  516. h0 = HASHi(fnv1,h,e,l,l,o),
  517. h1 = YHash("hello", .type = hash_fnv1, .sensitive = false);
  518. ASSERT(h0 == h1);
  519. }
  520. Test:y_stringhash__H7d()
  521. {
  522. new
  523. h0 = HASH:fnv1a<hello>,
  524. h1 = YHash("hello", .type = hash_fnv1a);
  525. ASSERT(h0 == h1);
  526. }
  527. Test:y_stringhash__I7d()
  528. {
  529. new
  530. h0 = HASHi:fnv1a<hello>,
  531. h1 = YHash("hello", .type = hash_fnv1a, .sensitive = false);
  532. ASSERT(h0 == h1);
  533. }
  534. Test:y_stringhash__H8d()
  535. {
  536. new
  537. h0 = HASH(fnv1a,h,e,l,l,o),
  538. h1 = YHash("hello", .type = hash_fnv1a);
  539. ASSERT(h0 == h1);
  540. }
  541. Test:y_stringhash__I8d()
  542. {
  543. new
  544. h0 = HASHi(fnv1a,h,e,l,l,o),
  545. h1 = YHash("hello", .type = hash_fnv1a, .sensitive = false);
  546. ASSERT(h0 == h1);
  547. }
  548. Test:y_stringhash__H3c()
  549. {
  550. new
  551. h0 = HASH:bernstein<hello>,
  552. h1 = _H(h,e,l,l,o);
  553. ASSERT(h0 == h1);
  554. }
  555. Test:y_stringhash__I3c()
  556. {
  557. new
  558. h0 = HASHi:bernstein<hello>,
  559. h1 = _I(h,e,L,L,o);
  560. ASSERT(h0 == h1);
  561. }
  562. Test:y_stringhash__H4c()
  563. {
  564. new
  565. h0 = HASH(bernstein,h,e,l,l,o),
  566. h1 = _H<hello>;
  567. ASSERT(h0 == h1);
  568. }
  569. Test:y_stringhash__I4c()
  570. {
  571. new
  572. h0 = HASHi(bernstein,h,e,l,l,o),
  573. h1 = _I<hellO>;
  574. ASSERT(h0 == h1);
  575. }
  576. Test:y_stringhash__H5c()
  577. {
  578. new
  579. h0 = HASH:fnv1<hello>,
  580. h1 = _H@f(h,e,l,l,o);
  581. ASSERT(h0 == h1);
  582. }
  583. Test:y_stringhash__I5c()
  584. {
  585. new
  586. h0 = HASHi:fnv1<hello>,
  587. h1 = _I@f(h,E,l,l,o);
  588. ASSERT(h0 == h1);
  589. }
  590. Test:y_stringhash__H6c()
  591. {
  592. new
  593. h0 = HASH(fnv1,h,e,l,l,o),
  594. h1 = _H@f<hello>;
  595. ASSERT(h0 == h1);
  596. }
  597. Test:y_stringhash__I6c()
  598. {
  599. new
  600. h0 = HASHi(fnv1,h,e,l,l,o),
  601. h1 = _I@f<hElLO>;
  602. ASSERT(h0 == h1);
  603. }
  604. Test:y_stringhash__H7c()
  605. {
  606. new
  607. h0 = HASH:fnv1a<hello>,
  608. h1 = _H@a(h,e,l,l,o);
  609. ASSERT(h0 == h1);
  610. }
  611. Test:y_stringhash__I7c()
  612. {
  613. new
  614. h0 = HASHi:fnv1a<hello>,
  615. h1 = _I@a(H,e,l,l,o);
  616. ASSERT(h0 == h1);
  617. }
  618. Test:y_stringhash__H8c()
  619. {
  620. new
  621. h0 = HASH(fnv1a,h,e,l,l,o),
  622. h1 = _H@a<hello>;
  623. ASSERT(h0 == h1);
  624. }
  625. Test:y_stringhash__I8c()
  626. {
  627. new
  628. h0 = HASHi(fnv1a,h,e,l,l,o),
  629. h1 = _I@a<HELLO>;
  630. ASSERT(h0 == h1);
  631. }
  632. Test:y_stringhash__H3b()
  633. {
  634. new
  635. h0 = HASH:bernstein<hello>,
  636. h1 = HASH:bernstein<there>;
  637. ASSERT(h0 != h1);
  638. }
  639. Test:y_stringhash__I3b()
  640. {
  641. new
  642. h0 = HASHi:bernstein<hello>,
  643. h1 = HASHi:bernstein<HelLo>;
  644. ASSERT(h0 == h1);
  645. }
  646. Test:y_stringhash__H4b()
  647. {
  648. new
  649. h0 = HASH(bernstein,h,e,l,l,o),
  650. h1 = HASH(bernstein,t,h,e,r,e);
  651. ASSERT(h0 != h1);
  652. }
  653. Test:y_stringhash__I4b()
  654. {
  655. new
  656. h0 = HASHi(bernstein,h,e,l,l,o),
  657. h1 = HASHi(bernstein,H,E,L,L,O);
  658. ASSERT(h0 == h1);
  659. }
  660. Test:y_stringhash__H5b()
  661. {
  662. new
  663. h0 = HASH:fnv1<hello>,
  664. h1 = HASH:fnv1<there>;
  665. ASSERT(h0 != h1);
  666. }
  667. Test:y_stringhash__I5b()
  668. {
  669. new
  670. h0 = HASHi:fnv1<hello>,
  671. h1 = HASHi:fnv1<HelLo>;
  672. ASSERT(h0 == h1);
  673. }
  674. Test:y_stringhash__H6b()
  675. {
  676. new
  677. h0 = HASH(fnv1,h,e,l,l,o),
  678. h1 = HASH(fnv1,t,h,e,r,e);
  679. ASSERT(h0 != h1);
  680. }
  681. Test:y_stringhash__I6b()
  682. {
  683. new
  684. h0 = HASHi(fnv1,h,e,l,l,o),
  685. h1 = HASHi(fnv1,H,E,L,L,O);
  686. ASSERT(h0 == h1);
  687. }
  688. Test:y_stringhash__H7b()
  689. {
  690. new
  691. h0 = HASH:fnv1a<hello>,
  692. h1 = HASH:fnv1a<there>;
  693. ASSERT(h0 != h1);
  694. }
  695. Test:y_stringhash__I7b()
  696. {
  697. new
  698. h0 = HASHi:fnv1a<hello>,
  699. h1 = HASHi:fnv1a<HelLo>;
  700. ASSERT(h0 == h1);
  701. }
  702. Test:y_stringhash__H8b()
  703. {
  704. new
  705. h0 = HASH(fnv1a,h,e,l,l,o),
  706. h1 = HASH(fnv1a,t,h,e,r,e);
  707. ASSERT(h0 != h1);
  708. }
  709. Test:y_stringhash__I8b()
  710. {
  711. new
  712. h0 = HASHi(fnv1a,h,e,l,l,o),
  713. h1 = HASHi(fnv1a,H,E,L,L,O);
  714. ASSERT(h0 == h1);
  715. }