master
   1//! This file is auto-generated by tools/update_crc_catalog.zig.
   2
   3const std = @import("std");
   4const testing = std.testing;
   5const verify = @import("../verify.zig");
   6const crc = @import("../crc.zig");
   7
   8test "crc32 ieee regression" {
   9    const crc32 = crc.Crc32IsoHdlc;
  10    try testing.expectEqual(crc32.hash(""), 0x00000000);
  11    try testing.expectEqual(crc32.hash("a"), 0xe8b7be43);
  12    try testing.expectEqual(crc32.hash("abc"), 0x352441c2);
  13}
  14
  15test "crc32 castagnoli regression" {
  16    const crc32 = crc.Crc32Iscsi;
  17    try testing.expectEqual(crc32.hash(""), 0x00000000);
  18    try testing.expectEqual(crc32.hash("a"), 0xc1d04330);
  19    try testing.expectEqual(crc32.hash("abc"), 0x364b3fb7);
  20}
  21
  22test "crc32 koopman regression" {
  23    const crc32 = crc.Crc32Koopman;
  24    try testing.expectEqual(crc32.hash(""), 0x00000000);
  25    try testing.expectEqual(crc32.hash("a"), 0x0da2aa8a);
  26    try testing.expectEqual(crc32.hash("abc"), 0xba2322ac);
  27}
  28
  29test "CRC-3/GSM" {
  30    const Crc3Gsm = crc.Crc3Gsm;
  31
  32    try testing.expectEqual(@as(u3, 0x4), Crc3Gsm.hash("123456789"));
  33
  34    var c = Crc3Gsm.init();
  35    c.update("1234");
  36    c.update("56789");
  37    try testing.expectEqual(@as(u3, 0x4), c.final());
  38}
  39
  40test "CRC-3/ROHC" {
  41    const Crc3Rohc = crc.Crc3Rohc;
  42
  43    try testing.expectEqual(@as(u3, 0x6), Crc3Rohc.hash("123456789"));
  44
  45    var c = Crc3Rohc.init();
  46    c.update("1234");
  47    c.update("56789");
  48    try testing.expectEqual(@as(u3, 0x6), c.final());
  49}
  50
  51test "CRC-4/G-704" {
  52    const Crc4G704 = crc.Crc4G704;
  53
  54    try testing.expectEqual(@as(u4, 0x7), Crc4G704.hash("123456789"));
  55
  56    var c = Crc4G704.init();
  57    c.update("1234");
  58    c.update("56789");
  59    try testing.expectEqual(@as(u4, 0x7), c.final());
  60}
  61
  62test "CRC-4/INTERLAKEN" {
  63    const Crc4Interlaken = crc.Crc4Interlaken;
  64
  65    try testing.expectEqual(@as(u4, 0xb), Crc4Interlaken.hash("123456789"));
  66
  67    var c = Crc4Interlaken.init();
  68    c.update("1234");
  69    c.update("56789");
  70    try testing.expectEqual(@as(u4, 0xb), c.final());
  71}
  72
  73test "CRC-5/EPC-C1G2" {
  74    const Crc5EpcC1g2 = crc.Crc5EpcC1g2;
  75
  76    try testing.expectEqual(@as(u5, 0x00), Crc5EpcC1g2.hash("123456789"));
  77
  78    var c = Crc5EpcC1g2.init();
  79    c.update("1234");
  80    c.update("56789");
  81    try testing.expectEqual(@as(u5, 0x00), c.final());
  82}
  83
  84test "CRC-5/G-704" {
  85    const Crc5G704 = crc.Crc5G704;
  86
  87    try testing.expectEqual(@as(u5, 0x07), Crc5G704.hash("123456789"));
  88
  89    var c = Crc5G704.init();
  90    c.update("1234");
  91    c.update("56789");
  92    try testing.expectEqual(@as(u5, 0x07), c.final());
  93}
  94
  95test "CRC-5/USB" {
  96    const Crc5Usb = crc.Crc5Usb;
  97
  98    try testing.expectEqual(@as(u5, 0x19), Crc5Usb.hash("123456789"));
  99
 100    var c = Crc5Usb.init();
 101    c.update("1234");
 102    c.update("56789");
 103    try testing.expectEqual(@as(u5, 0x19), c.final());
 104}
 105
 106test "CRC-6/CDMA2000-A" {
 107    const Crc6Cdma2000A = crc.Crc6Cdma2000A;
 108
 109    try testing.expectEqual(@as(u6, 0x0d), Crc6Cdma2000A.hash("123456789"));
 110
 111    var c = Crc6Cdma2000A.init();
 112    c.update("1234");
 113    c.update("56789");
 114    try testing.expectEqual(@as(u6, 0x0d), c.final());
 115}
 116
 117test "CRC-6/CDMA2000-B" {
 118    const Crc6Cdma2000B = crc.Crc6Cdma2000B;
 119
 120    try testing.expectEqual(@as(u6, 0x3b), Crc6Cdma2000B.hash("123456789"));
 121
 122    var c = Crc6Cdma2000B.init();
 123    c.update("1234");
 124    c.update("56789");
 125    try testing.expectEqual(@as(u6, 0x3b), c.final());
 126}
 127
 128test "CRC-6/DARC" {
 129    const Crc6Darc = crc.Crc6Darc;
 130
 131    try testing.expectEqual(@as(u6, 0x26), Crc6Darc.hash("123456789"));
 132
 133    var c = Crc6Darc.init();
 134    c.update("1234");
 135    c.update("56789");
 136    try testing.expectEqual(@as(u6, 0x26), c.final());
 137}
 138
 139test "CRC-6/G-704" {
 140    const Crc6G704 = crc.Crc6G704;
 141
 142    try testing.expectEqual(@as(u6, 0x06), Crc6G704.hash("123456789"));
 143
 144    var c = Crc6G704.init();
 145    c.update("1234");
 146    c.update("56789");
 147    try testing.expectEqual(@as(u6, 0x06), c.final());
 148}
 149
 150test "CRC-6/GSM" {
 151    const Crc6Gsm = crc.Crc6Gsm;
 152
 153    try testing.expectEqual(@as(u6, 0x13), Crc6Gsm.hash("123456789"));
 154
 155    var c = Crc6Gsm.init();
 156    c.update("1234");
 157    c.update("56789");
 158    try testing.expectEqual(@as(u6, 0x13), c.final());
 159}
 160
 161test "CRC-7/MMC" {
 162    const Crc7Mmc = crc.Crc7Mmc;
 163
 164    try testing.expectEqual(@as(u7, 0x75), Crc7Mmc.hash("123456789"));
 165
 166    var c = Crc7Mmc.init();
 167    c.update("1234");
 168    c.update("56789");
 169    try testing.expectEqual(@as(u7, 0x75), c.final());
 170}
 171
 172test "CRC-7/ROHC" {
 173    const Crc7Rohc = crc.Crc7Rohc;
 174
 175    try testing.expectEqual(@as(u7, 0x53), Crc7Rohc.hash("123456789"));
 176
 177    var c = Crc7Rohc.init();
 178    c.update("1234");
 179    c.update("56789");
 180    try testing.expectEqual(@as(u7, 0x53), c.final());
 181}
 182
 183test "CRC-7/UMTS" {
 184    const Crc7Umts = crc.Crc7Umts;
 185
 186    try testing.expectEqual(@as(u7, 0x61), Crc7Umts.hash("123456789"));
 187
 188    var c = Crc7Umts.init();
 189    c.update("1234");
 190    c.update("56789");
 191    try testing.expectEqual(@as(u7, 0x61), c.final());
 192}
 193
 194test "CRC-8/AUTOSAR" {
 195    const Crc8Autosar = crc.Crc8Autosar;
 196
 197    try testing.expectEqual(@as(u8, 0xdf), Crc8Autosar.hash("123456789"));
 198
 199    var c = Crc8Autosar.init();
 200    c.update("1234");
 201    c.update("56789");
 202    try testing.expectEqual(@as(u8, 0xdf), c.final());
 203}
 204
 205test "CRC-8/BLUETOOTH" {
 206    const Crc8Bluetooth = crc.Crc8Bluetooth;
 207
 208    try testing.expectEqual(@as(u8, 0x26), Crc8Bluetooth.hash("123456789"));
 209
 210    var c = Crc8Bluetooth.init();
 211    c.update("1234");
 212    c.update("56789");
 213    try testing.expectEqual(@as(u8, 0x26), c.final());
 214}
 215
 216test "CRC-8/CDMA2000" {
 217    const Crc8Cdma2000 = crc.Crc8Cdma2000;
 218
 219    try testing.expectEqual(@as(u8, 0xda), Crc8Cdma2000.hash("123456789"));
 220
 221    var c = Crc8Cdma2000.init();
 222    c.update("1234");
 223    c.update("56789");
 224    try testing.expectEqual(@as(u8, 0xda), c.final());
 225}
 226
 227test "CRC-8/DARC" {
 228    const Crc8Darc = crc.Crc8Darc;
 229
 230    try testing.expectEqual(@as(u8, 0x15), Crc8Darc.hash("123456789"));
 231
 232    var c = Crc8Darc.init();
 233    c.update("1234");
 234    c.update("56789");
 235    try testing.expectEqual(@as(u8, 0x15), c.final());
 236}
 237
 238test "CRC-8/DVB-S2" {
 239    const Crc8DvbS2 = crc.Crc8DvbS2;
 240
 241    try testing.expectEqual(@as(u8, 0xbc), Crc8DvbS2.hash("123456789"));
 242
 243    var c = Crc8DvbS2.init();
 244    c.update("1234");
 245    c.update("56789");
 246    try testing.expectEqual(@as(u8, 0xbc), c.final());
 247}
 248
 249test "CRC-8/GSM-A" {
 250    const Crc8GsmA = crc.Crc8GsmA;
 251
 252    try testing.expectEqual(@as(u8, 0x37), Crc8GsmA.hash("123456789"));
 253
 254    var c = Crc8GsmA.init();
 255    c.update("1234");
 256    c.update("56789");
 257    try testing.expectEqual(@as(u8, 0x37), c.final());
 258}
 259
 260test "CRC-8/GSM-B" {
 261    const Crc8GsmB = crc.Crc8GsmB;
 262
 263    try testing.expectEqual(@as(u8, 0x94), Crc8GsmB.hash("123456789"));
 264
 265    var c = Crc8GsmB.init();
 266    c.update("1234");
 267    c.update("56789");
 268    try testing.expectEqual(@as(u8, 0x94), c.final());
 269}
 270
 271test "CRC-8/HITAG" {
 272    const Crc8Hitag = crc.Crc8Hitag;
 273
 274    try testing.expectEqual(@as(u8, 0xb4), Crc8Hitag.hash("123456789"));
 275
 276    var c = Crc8Hitag.init();
 277    c.update("1234");
 278    c.update("56789");
 279    try testing.expectEqual(@as(u8, 0xb4), c.final());
 280}
 281
 282test "CRC-8/I-432-1" {
 283    const Crc8I4321 = crc.Crc8I4321;
 284
 285    try testing.expectEqual(@as(u8, 0xa1), Crc8I4321.hash("123456789"));
 286
 287    var c = Crc8I4321.init();
 288    c.update("1234");
 289    c.update("56789");
 290    try testing.expectEqual(@as(u8, 0xa1), c.final());
 291}
 292
 293test "CRC-8/I-CODE" {
 294    const Crc8ICode = crc.Crc8ICode;
 295
 296    try testing.expectEqual(@as(u8, 0x7e), Crc8ICode.hash("123456789"));
 297
 298    var c = Crc8ICode.init();
 299    c.update("1234");
 300    c.update("56789");
 301    try testing.expectEqual(@as(u8, 0x7e), c.final());
 302}
 303
 304test "CRC-8/LTE" {
 305    const Crc8Lte = crc.Crc8Lte;
 306
 307    try testing.expectEqual(@as(u8, 0xea), Crc8Lte.hash("123456789"));
 308
 309    var c = Crc8Lte.init();
 310    c.update("1234");
 311    c.update("56789");
 312    try testing.expectEqual(@as(u8, 0xea), c.final());
 313}
 314
 315test "CRC-8/MAXIM-DOW" {
 316    const Crc8MaximDow = crc.Crc8MaximDow;
 317
 318    try testing.expectEqual(@as(u8, 0xa1), Crc8MaximDow.hash("123456789"));
 319
 320    var c = Crc8MaximDow.init();
 321    c.update("1234");
 322    c.update("56789");
 323    try testing.expectEqual(@as(u8, 0xa1), c.final());
 324}
 325
 326test "CRC-8/MIFARE-MAD" {
 327    const Crc8MifareMad = crc.Crc8MifareMad;
 328
 329    try testing.expectEqual(@as(u8, 0x99), Crc8MifareMad.hash("123456789"));
 330
 331    var c = Crc8MifareMad.init();
 332    c.update("1234");
 333    c.update("56789");
 334    try testing.expectEqual(@as(u8, 0x99), c.final());
 335}
 336
 337test "CRC-8/NRSC-5" {
 338    const Crc8Nrsc5 = crc.Crc8Nrsc5;
 339
 340    try testing.expectEqual(@as(u8, 0xf7), Crc8Nrsc5.hash("123456789"));
 341
 342    var c = Crc8Nrsc5.init();
 343    c.update("1234");
 344    c.update("56789");
 345    try testing.expectEqual(@as(u8, 0xf7), c.final());
 346}
 347
 348test "CRC-8/OPENSAFETY" {
 349    const Crc8Opensafety = crc.Crc8Opensafety;
 350
 351    try testing.expectEqual(@as(u8, 0x3e), Crc8Opensafety.hash("123456789"));
 352
 353    var c = Crc8Opensafety.init();
 354    c.update("1234");
 355    c.update("56789");
 356    try testing.expectEqual(@as(u8, 0x3e), c.final());
 357}
 358
 359test "CRC-8/ROHC" {
 360    const Crc8Rohc = crc.Crc8Rohc;
 361
 362    try testing.expectEqual(@as(u8, 0xd0), Crc8Rohc.hash("123456789"));
 363
 364    var c = Crc8Rohc.init();
 365    c.update("1234");
 366    c.update("56789");
 367    try testing.expectEqual(@as(u8, 0xd0), c.final());
 368}
 369
 370test "CRC-8/SAE-J1850" {
 371    const Crc8SaeJ1850 = crc.Crc8SaeJ1850;
 372
 373    try testing.expectEqual(@as(u8, 0x4b), Crc8SaeJ1850.hash("123456789"));
 374
 375    var c = Crc8SaeJ1850.init();
 376    c.update("1234");
 377    c.update("56789");
 378    try testing.expectEqual(@as(u8, 0x4b), c.final());
 379}
 380
 381test "CRC-8/SMBUS" {
 382    const Crc8Smbus = crc.Crc8Smbus;
 383
 384    try testing.expectEqual(@as(u8, 0xf4), Crc8Smbus.hash("123456789"));
 385
 386    var c = Crc8Smbus.init();
 387    c.update("1234");
 388    c.update("56789");
 389    try testing.expectEqual(@as(u8, 0xf4), c.final());
 390}
 391
 392test "CRC-8/TECH-3250" {
 393    const Crc8Tech3250 = crc.Crc8Tech3250;
 394
 395    try testing.expectEqual(@as(u8, 0x97), Crc8Tech3250.hash("123456789"));
 396
 397    var c = Crc8Tech3250.init();
 398    c.update("1234");
 399    c.update("56789");
 400    try testing.expectEqual(@as(u8, 0x97), c.final());
 401}
 402
 403test "CRC-8/WCDMA" {
 404    const Crc8Wcdma = crc.Crc8Wcdma;
 405
 406    try testing.expectEqual(@as(u8, 0x25), Crc8Wcdma.hash("123456789"));
 407
 408    var c = Crc8Wcdma.init();
 409    c.update("1234");
 410    c.update("56789");
 411    try testing.expectEqual(@as(u8, 0x25), c.final());
 412}
 413
 414test "CRC-10/ATM" {
 415    const Crc10Atm = crc.Crc10Atm;
 416
 417    try testing.expectEqual(@as(u10, 0x199), Crc10Atm.hash("123456789"));
 418
 419    var c = Crc10Atm.init();
 420    c.update("1234");
 421    c.update("56789");
 422    try testing.expectEqual(@as(u10, 0x199), c.final());
 423}
 424
 425test "CRC-10/CDMA2000" {
 426    const Crc10Cdma2000 = crc.Crc10Cdma2000;
 427
 428    try testing.expectEqual(@as(u10, 0x233), Crc10Cdma2000.hash("123456789"));
 429
 430    var c = Crc10Cdma2000.init();
 431    c.update("1234");
 432    c.update("56789");
 433    try testing.expectEqual(@as(u10, 0x233), c.final());
 434}
 435
 436test "CRC-10/GSM" {
 437    const Crc10Gsm = crc.Crc10Gsm;
 438
 439    try testing.expectEqual(@as(u10, 0x12a), Crc10Gsm.hash("123456789"));
 440
 441    var c = Crc10Gsm.init();
 442    c.update("1234");
 443    c.update("56789");
 444    try testing.expectEqual(@as(u10, 0x12a), c.final());
 445}
 446
 447test "CRC-11/FLEXRAY" {
 448    const Crc11Flexray = crc.Crc11Flexray;
 449
 450    try testing.expectEqual(@as(u11, 0x5a3), Crc11Flexray.hash("123456789"));
 451
 452    var c = Crc11Flexray.init();
 453    c.update("1234");
 454    c.update("56789");
 455    try testing.expectEqual(@as(u11, 0x5a3), c.final());
 456}
 457
 458test "CRC-11/UMTS" {
 459    const Crc11Umts = crc.Crc11Umts;
 460
 461    try testing.expectEqual(@as(u11, 0x061), Crc11Umts.hash("123456789"));
 462
 463    var c = Crc11Umts.init();
 464    c.update("1234");
 465    c.update("56789");
 466    try testing.expectEqual(@as(u11, 0x061), c.final());
 467}
 468
 469test "CRC-12/CDMA2000" {
 470    const Crc12Cdma2000 = crc.Crc12Cdma2000;
 471
 472    try testing.expectEqual(@as(u12, 0xd4d), Crc12Cdma2000.hash("123456789"));
 473
 474    var c = Crc12Cdma2000.init();
 475    c.update("1234");
 476    c.update("56789");
 477    try testing.expectEqual(@as(u12, 0xd4d), c.final());
 478}
 479
 480test "CRC-12/DECT" {
 481    const Crc12Dect = crc.Crc12Dect;
 482
 483    try testing.expectEqual(@as(u12, 0xf5b), Crc12Dect.hash("123456789"));
 484
 485    var c = Crc12Dect.init();
 486    c.update("1234");
 487    c.update("56789");
 488    try testing.expectEqual(@as(u12, 0xf5b), c.final());
 489}
 490
 491test "CRC-12/GSM" {
 492    const Crc12Gsm = crc.Crc12Gsm;
 493
 494    try testing.expectEqual(@as(u12, 0xb34), Crc12Gsm.hash("123456789"));
 495
 496    var c = Crc12Gsm.init();
 497    c.update("1234");
 498    c.update("56789");
 499    try testing.expectEqual(@as(u12, 0xb34), c.final());
 500}
 501
 502test "CRC-12/UMTS" {
 503    const Crc12Umts = crc.Crc12Umts;
 504
 505    try testing.expectEqual(@as(u12, 0xdaf), Crc12Umts.hash("123456789"));
 506
 507    var c = Crc12Umts.init();
 508    c.update("1234");
 509    c.update("56789");
 510    try testing.expectEqual(@as(u12, 0xdaf), c.final());
 511}
 512
 513test "CRC-13/BBC" {
 514    const Crc13Bbc = crc.Crc13Bbc;
 515
 516    try testing.expectEqual(@as(u13, 0x04fa), Crc13Bbc.hash("123456789"));
 517
 518    var c = Crc13Bbc.init();
 519    c.update("1234");
 520    c.update("56789");
 521    try testing.expectEqual(@as(u13, 0x04fa), c.final());
 522}
 523
 524test "CRC-14/DARC" {
 525    const Crc14Darc = crc.Crc14Darc;
 526
 527    try testing.expectEqual(@as(u14, 0x082d), Crc14Darc.hash("123456789"));
 528
 529    var c = Crc14Darc.init();
 530    c.update("1234");
 531    c.update("56789");
 532    try testing.expectEqual(@as(u14, 0x082d), c.final());
 533}
 534
 535test "CRC-14/GSM" {
 536    const Crc14Gsm = crc.Crc14Gsm;
 537
 538    try testing.expectEqual(@as(u14, 0x30ae), Crc14Gsm.hash("123456789"));
 539
 540    var c = Crc14Gsm.init();
 541    c.update("1234");
 542    c.update("56789");
 543    try testing.expectEqual(@as(u14, 0x30ae), c.final());
 544}
 545
 546test "CRC-15/CAN" {
 547    const Crc15Can = crc.Crc15Can;
 548
 549    try testing.expectEqual(@as(u15, 0x059e), Crc15Can.hash("123456789"));
 550
 551    var c = Crc15Can.init();
 552    c.update("1234");
 553    c.update("56789");
 554    try testing.expectEqual(@as(u15, 0x059e), c.final());
 555}
 556
 557test "CRC-15/MPT1327" {
 558    const Crc15Mpt1327 = crc.Crc15Mpt1327;
 559
 560    try testing.expectEqual(@as(u15, 0x2566), Crc15Mpt1327.hash("123456789"));
 561
 562    var c = Crc15Mpt1327.init();
 563    c.update("1234");
 564    c.update("56789");
 565    try testing.expectEqual(@as(u15, 0x2566), c.final());
 566}
 567
 568test "CRC-16/ARC" {
 569    const Crc16Arc = crc.Crc16Arc;
 570
 571    try testing.expectEqual(@as(u16, 0xbb3d), Crc16Arc.hash("123456789"));
 572
 573    var c = Crc16Arc.init();
 574    c.update("1234");
 575    c.update("56789");
 576    try testing.expectEqual(@as(u16, 0xbb3d), c.final());
 577}
 578
 579test "CRC-16/CDMA2000" {
 580    const Crc16Cdma2000 = crc.Crc16Cdma2000;
 581
 582    try testing.expectEqual(@as(u16, 0x4c06), Crc16Cdma2000.hash("123456789"));
 583
 584    var c = Crc16Cdma2000.init();
 585    c.update("1234");
 586    c.update("56789");
 587    try testing.expectEqual(@as(u16, 0x4c06), c.final());
 588}
 589
 590test "CRC-16/CMS" {
 591    const Crc16Cms = crc.Crc16Cms;
 592
 593    try testing.expectEqual(@as(u16, 0xaee7), Crc16Cms.hash("123456789"));
 594
 595    var c = Crc16Cms.init();
 596    c.update("1234");
 597    c.update("56789");
 598    try testing.expectEqual(@as(u16, 0xaee7), c.final());
 599}
 600
 601test "CRC-16/DDS-110" {
 602    const Crc16Dds110 = crc.Crc16Dds110;
 603
 604    try testing.expectEqual(@as(u16, 0x9ecf), Crc16Dds110.hash("123456789"));
 605
 606    var c = Crc16Dds110.init();
 607    c.update("1234");
 608    c.update("56789");
 609    try testing.expectEqual(@as(u16, 0x9ecf), c.final());
 610}
 611
 612test "CRC-16/DECT-R" {
 613    const Crc16DectR = crc.Crc16DectR;
 614
 615    try testing.expectEqual(@as(u16, 0x007e), Crc16DectR.hash("123456789"));
 616
 617    var c = Crc16DectR.init();
 618    c.update("1234");
 619    c.update("56789");
 620    try testing.expectEqual(@as(u16, 0x007e), c.final());
 621}
 622
 623test "CRC-16/DECT-X" {
 624    const Crc16DectX = crc.Crc16DectX;
 625
 626    try testing.expectEqual(@as(u16, 0x007f), Crc16DectX.hash("123456789"));
 627
 628    var c = Crc16DectX.init();
 629    c.update("1234");
 630    c.update("56789");
 631    try testing.expectEqual(@as(u16, 0x007f), c.final());
 632}
 633
 634test "CRC-16/DNP" {
 635    const Crc16Dnp = crc.Crc16Dnp;
 636
 637    try testing.expectEqual(@as(u16, 0xea82), Crc16Dnp.hash("123456789"));
 638
 639    var c = Crc16Dnp.init();
 640    c.update("1234");
 641    c.update("56789");
 642    try testing.expectEqual(@as(u16, 0xea82), c.final());
 643}
 644
 645test "CRC-16/EN-13757" {
 646    const Crc16En13757 = crc.Crc16En13757;
 647
 648    try testing.expectEqual(@as(u16, 0xc2b7), Crc16En13757.hash("123456789"));
 649
 650    var c = Crc16En13757.init();
 651    c.update("1234");
 652    c.update("56789");
 653    try testing.expectEqual(@as(u16, 0xc2b7), c.final());
 654}
 655
 656test "CRC-16/GENIBUS" {
 657    const Crc16Genibus = crc.Crc16Genibus;
 658
 659    try testing.expectEqual(@as(u16, 0xd64e), Crc16Genibus.hash("123456789"));
 660
 661    var c = Crc16Genibus.init();
 662    c.update("1234");
 663    c.update("56789");
 664    try testing.expectEqual(@as(u16, 0xd64e), c.final());
 665}
 666
 667test "CRC-16/GSM" {
 668    const Crc16Gsm = crc.Crc16Gsm;
 669
 670    try testing.expectEqual(@as(u16, 0xce3c), Crc16Gsm.hash("123456789"));
 671
 672    var c = Crc16Gsm.init();
 673    c.update("1234");
 674    c.update("56789");
 675    try testing.expectEqual(@as(u16, 0xce3c), c.final());
 676}
 677
 678test "CRC-16/IBM-3740" {
 679    const Crc16Ibm3740 = crc.Crc16Ibm3740;
 680
 681    try testing.expectEqual(@as(u16, 0x29b1), Crc16Ibm3740.hash("123456789"));
 682
 683    var c = Crc16Ibm3740.init();
 684    c.update("1234");
 685    c.update("56789");
 686    try testing.expectEqual(@as(u16, 0x29b1), c.final());
 687}
 688
 689test "CRC-16/IBM-SDLC" {
 690    const Crc16IbmSdlc = crc.Crc16IbmSdlc;
 691
 692    try testing.expectEqual(@as(u16, 0x906e), Crc16IbmSdlc.hash("123456789"));
 693
 694    var c = Crc16IbmSdlc.init();
 695    c.update("1234");
 696    c.update("56789");
 697    try testing.expectEqual(@as(u16, 0x906e), c.final());
 698}
 699
 700test "CRC-16/ISO-IEC-14443-3-A" {
 701    const Crc16IsoIec144433A = crc.Crc16IsoIec144433A;
 702
 703    try testing.expectEqual(@as(u16, 0xbf05), Crc16IsoIec144433A.hash("123456789"));
 704
 705    var c = Crc16IsoIec144433A.init();
 706    c.update("1234");
 707    c.update("56789");
 708    try testing.expectEqual(@as(u16, 0xbf05), c.final());
 709}
 710
 711test "CRC-16/KERMIT" {
 712    const Crc16Kermit = crc.Crc16Kermit;
 713
 714    try testing.expectEqual(@as(u16, 0x2189), Crc16Kermit.hash("123456789"));
 715
 716    var c = Crc16Kermit.init();
 717    c.update("1234");
 718    c.update("56789");
 719    try testing.expectEqual(@as(u16, 0x2189), c.final());
 720}
 721
 722test "CRC-16/LJ1200" {
 723    const Crc16Lj1200 = crc.Crc16Lj1200;
 724
 725    try testing.expectEqual(@as(u16, 0xbdf4), Crc16Lj1200.hash("123456789"));
 726
 727    var c = Crc16Lj1200.init();
 728    c.update("1234");
 729    c.update("56789");
 730    try testing.expectEqual(@as(u16, 0xbdf4), c.final());
 731}
 732
 733test "CRC-16/M17" {
 734    const Crc16M17 = crc.Crc16M17;
 735
 736    try testing.expectEqual(@as(u16, 0x772b), Crc16M17.hash("123456789"));
 737
 738    var c = Crc16M17.init();
 739    c.update("1234");
 740    c.update("56789");
 741    try testing.expectEqual(@as(u16, 0x772b), c.final());
 742}
 743
 744test "CRC-16/MAXIM-DOW" {
 745    const Crc16MaximDow = crc.Crc16MaximDow;
 746
 747    try testing.expectEqual(@as(u16, 0x44c2), Crc16MaximDow.hash("123456789"));
 748
 749    var c = Crc16MaximDow.init();
 750    c.update("1234");
 751    c.update("56789");
 752    try testing.expectEqual(@as(u16, 0x44c2), c.final());
 753}
 754
 755test "CRC-16/MCRF4XX" {
 756    const Crc16Mcrf4xx = crc.Crc16Mcrf4xx;
 757
 758    try testing.expectEqual(@as(u16, 0x6f91), Crc16Mcrf4xx.hash("123456789"));
 759
 760    var c = Crc16Mcrf4xx.init();
 761    c.update("1234");
 762    c.update("56789");
 763    try testing.expectEqual(@as(u16, 0x6f91), c.final());
 764}
 765
 766test "CRC-16/MODBUS" {
 767    const Crc16Modbus = crc.Crc16Modbus;
 768
 769    try testing.expectEqual(@as(u16, 0x4b37), Crc16Modbus.hash("123456789"));
 770
 771    var c = Crc16Modbus.init();
 772    c.update("1234");
 773    c.update("56789");
 774    try testing.expectEqual(@as(u16, 0x4b37), c.final());
 775}
 776
 777test "CRC-16/NRSC-5" {
 778    const Crc16Nrsc5 = crc.Crc16Nrsc5;
 779
 780    try testing.expectEqual(@as(u16, 0xa066), Crc16Nrsc5.hash("123456789"));
 781
 782    var c = Crc16Nrsc5.init();
 783    c.update("1234");
 784    c.update("56789");
 785    try testing.expectEqual(@as(u16, 0xa066), c.final());
 786}
 787
 788test "CRC-16/OPENSAFETY-A" {
 789    const Crc16OpensafetyA = crc.Crc16OpensafetyA;
 790
 791    try testing.expectEqual(@as(u16, 0x5d38), Crc16OpensafetyA.hash("123456789"));
 792
 793    var c = Crc16OpensafetyA.init();
 794    c.update("1234");
 795    c.update("56789");
 796    try testing.expectEqual(@as(u16, 0x5d38), c.final());
 797}
 798
 799test "CRC-16/OPENSAFETY-B" {
 800    const Crc16OpensafetyB = crc.Crc16OpensafetyB;
 801
 802    try testing.expectEqual(@as(u16, 0x20fe), Crc16OpensafetyB.hash("123456789"));
 803
 804    var c = Crc16OpensafetyB.init();
 805    c.update("1234");
 806    c.update("56789");
 807    try testing.expectEqual(@as(u16, 0x20fe), c.final());
 808}
 809
 810test "CRC-16/PROFIBUS" {
 811    const Crc16Profibus = crc.Crc16Profibus;
 812
 813    try testing.expectEqual(@as(u16, 0xa819), Crc16Profibus.hash("123456789"));
 814
 815    var c = Crc16Profibus.init();
 816    c.update("1234");
 817    c.update("56789");
 818    try testing.expectEqual(@as(u16, 0xa819), c.final());
 819}
 820
 821test "CRC-16/RIELLO" {
 822    const Crc16Riello = crc.Crc16Riello;
 823
 824    try testing.expectEqual(@as(u16, 0x63d0), Crc16Riello.hash("123456789"));
 825
 826    var c = Crc16Riello.init();
 827    c.update("1234");
 828    c.update("56789");
 829    try testing.expectEqual(@as(u16, 0x63d0), c.final());
 830}
 831
 832test "CRC-16/SPI-FUJITSU" {
 833    const Crc16SpiFujitsu = crc.Crc16SpiFujitsu;
 834
 835    try testing.expectEqual(@as(u16, 0xe5cc), Crc16SpiFujitsu.hash("123456789"));
 836
 837    var c = Crc16SpiFujitsu.init();
 838    c.update("1234");
 839    c.update("56789");
 840    try testing.expectEqual(@as(u16, 0xe5cc), c.final());
 841}
 842
 843test "CRC-16/T10-DIF" {
 844    const Crc16T10Dif = crc.Crc16T10Dif;
 845
 846    try testing.expectEqual(@as(u16, 0xd0db), Crc16T10Dif.hash("123456789"));
 847
 848    var c = Crc16T10Dif.init();
 849    c.update("1234");
 850    c.update("56789");
 851    try testing.expectEqual(@as(u16, 0xd0db), c.final());
 852}
 853
 854test "CRC-16/TELEDISK" {
 855    const Crc16Teledisk = crc.Crc16Teledisk;
 856
 857    try testing.expectEqual(@as(u16, 0x0fb3), Crc16Teledisk.hash("123456789"));
 858
 859    var c = Crc16Teledisk.init();
 860    c.update("1234");
 861    c.update("56789");
 862    try testing.expectEqual(@as(u16, 0x0fb3), c.final());
 863}
 864
 865test "CRC-16/TMS37157" {
 866    const Crc16Tms37157 = crc.Crc16Tms37157;
 867
 868    try testing.expectEqual(@as(u16, 0x26b1), Crc16Tms37157.hash("123456789"));
 869
 870    var c = Crc16Tms37157.init();
 871    c.update("1234");
 872    c.update("56789");
 873    try testing.expectEqual(@as(u16, 0x26b1), c.final());
 874}
 875
 876test "CRC-16/UMTS" {
 877    const Crc16Umts = crc.Crc16Umts;
 878
 879    try testing.expectEqual(@as(u16, 0xfee8), Crc16Umts.hash("123456789"));
 880
 881    var c = Crc16Umts.init();
 882    c.update("1234");
 883    c.update("56789");
 884    try testing.expectEqual(@as(u16, 0xfee8), c.final());
 885}
 886
 887test "CRC-16/USB" {
 888    const Crc16Usb = crc.Crc16Usb;
 889
 890    try testing.expectEqual(@as(u16, 0xb4c8), Crc16Usb.hash("123456789"));
 891
 892    var c = Crc16Usb.init();
 893    c.update("1234");
 894    c.update("56789");
 895    try testing.expectEqual(@as(u16, 0xb4c8), c.final());
 896}
 897
 898test "CRC-16/XMODEM" {
 899    const Crc16Xmodem = crc.Crc16Xmodem;
 900
 901    try testing.expectEqual(@as(u16, 0x31c3), Crc16Xmodem.hash("123456789"));
 902
 903    var c = Crc16Xmodem.init();
 904    c.update("1234");
 905    c.update("56789");
 906    try testing.expectEqual(@as(u16, 0x31c3), c.final());
 907}
 908
 909test "CRC-17/CAN-FD" {
 910    const Crc17CanFd = crc.Crc17CanFd;
 911
 912    try testing.expectEqual(@as(u17, 0x04f03), Crc17CanFd.hash("123456789"));
 913
 914    var c = Crc17CanFd.init();
 915    c.update("1234");
 916    c.update("56789");
 917    try testing.expectEqual(@as(u17, 0x04f03), c.final());
 918}
 919
 920test "CRC-21/CAN-FD" {
 921    const Crc21CanFd = crc.Crc21CanFd;
 922
 923    try testing.expectEqual(@as(u21, 0x0ed841), Crc21CanFd.hash("123456789"));
 924
 925    var c = Crc21CanFd.init();
 926    c.update("1234");
 927    c.update("56789");
 928    try testing.expectEqual(@as(u21, 0x0ed841), c.final());
 929}
 930
 931test "CRC-24/BLE" {
 932    const Crc24Ble = crc.Crc24Ble;
 933
 934    try testing.expectEqual(@as(u24, 0xc25a56), Crc24Ble.hash("123456789"));
 935
 936    var c = Crc24Ble.init();
 937    c.update("1234");
 938    c.update("56789");
 939    try testing.expectEqual(@as(u24, 0xc25a56), c.final());
 940}
 941
 942test "CRC-24/FLEXRAY-A" {
 943    const Crc24FlexrayA = crc.Crc24FlexrayA;
 944
 945    try testing.expectEqual(@as(u24, 0x7979bd), Crc24FlexrayA.hash("123456789"));
 946
 947    var c = Crc24FlexrayA.init();
 948    c.update("1234");
 949    c.update("56789");
 950    try testing.expectEqual(@as(u24, 0x7979bd), c.final());
 951}
 952
 953test "CRC-24/FLEXRAY-B" {
 954    const Crc24FlexrayB = crc.Crc24FlexrayB;
 955
 956    try testing.expectEqual(@as(u24, 0x1f23b8), Crc24FlexrayB.hash("123456789"));
 957
 958    var c = Crc24FlexrayB.init();
 959    c.update("1234");
 960    c.update("56789");
 961    try testing.expectEqual(@as(u24, 0x1f23b8), c.final());
 962}
 963
 964test "CRC-24/INTERLAKEN" {
 965    const Crc24Interlaken = crc.Crc24Interlaken;
 966
 967    try testing.expectEqual(@as(u24, 0xb4f3e6), Crc24Interlaken.hash("123456789"));
 968
 969    var c = Crc24Interlaken.init();
 970    c.update("1234");
 971    c.update("56789");
 972    try testing.expectEqual(@as(u24, 0xb4f3e6), c.final());
 973}
 974
 975test "CRC-24/LTE-A" {
 976    const Crc24LteA = crc.Crc24LteA;
 977
 978    try testing.expectEqual(@as(u24, 0xcde703), Crc24LteA.hash("123456789"));
 979
 980    var c = Crc24LteA.init();
 981    c.update("1234");
 982    c.update("56789");
 983    try testing.expectEqual(@as(u24, 0xcde703), c.final());
 984}
 985
 986test "CRC-24/LTE-B" {
 987    const Crc24LteB = crc.Crc24LteB;
 988
 989    try testing.expectEqual(@as(u24, 0x23ef52), Crc24LteB.hash("123456789"));
 990
 991    var c = Crc24LteB.init();
 992    c.update("1234");
 993    c.update("56789");
 994    try testing.expectEqual(@as(u24, 0x23ef52), c.final());
 995}
 996
 997test "CRC-24/OPENPGP" {
 998    const Crc24Openpgp = crc.Crc24Openpgp;
 999
1000    try testing.expectEqual(@as(u24, 0x21cf02), Crc24Openpgp.hash("123456789"));
1001
1002    var c = Crc24Openpgp.init();
1003    c.update("1234");
1004    c.update("56789");
1005    try testing.expectEqual(@as(u24, 0x21cf02), c.final());
1006}
1007
1008test "CRC-24/OS-9" {
1009    const Crc24Os9 = crc.Crc24Os9;
1010
1011    try testing.expectEqual(@as(u24, 0x200fa5), Crc24Os9.hash("123456789"));
1012
1013    var c = Crc24Os9.init();
1014    c.update("1234");
1015    c.update("56789");
1016    try testing.expectEqual(@as(u24, 0x200fa5), c.final());
1017}
1018
1019test "CRC-30/CDMA" {
1020    const Crc30Cdma = crc.Crc30Cdma;
1021
1022    try testing.expectEqual(@as(u30, 0x04c34abf), Crc30Cdma.hash("123456789"));
1023
1024    var c = Crc30Cdma.init();
1025    c.update("1234");
1026    c.update("56789");
1027    try testing.expectEqual(@as(u30, 0x04c34abf), c.final());
1028}
1029
1030test "CRC-31/PHILIPS" {
1031    const Crc31Philips = crc.Crc31Philips;
1032
1033    try testing.expectEqual(@as(u31, 0x0ce9e46c), Crc31Philips.hash("123456789"));
1034
1035    var c = Crc31Philips.init();
1036    c.update("1234");
1037    c.update("56789");
1038    try testing.expectEqual(@as(u31, 0x0ce9e46c), c.final());
1039}
1040
1041test "CRC-32/AIXM" {
1042    const Crc32Aixm = crc.Crc32Aixm;
1043
1044    try testing.expectEqual(@as(u32, 0x3010bf7f), Crc32Aixm.hash("123456789"));
1045
1046    var c = Crc32Aixm.init();
1047    c.update("1234");
1048    c.update("56789");
1049    try testing.expectEqual(@as(u32, 0x3010bf7f), c.final());
1050}
1051
1052test "CRC-32/AUTOSAR" {
1053    const Crc32Autosar = crc.Crc32Autosar;
1054
1055    try testing.expectEqual(@as(u32, 0x1697d06a), Crc32Autosar.hash("123456789"));
1056
1057    var c = Crc32Autosar.init();
1058    c.update("1234");
1059    c.update("56789");
1060    try testing.expectEqual(@as(u32, 0x1697d06a), c.final());
1061}
1062
1063test "CRC-32/BASE91-D" {
1064    const Crc32Base91D = crc.Crc32Base91D;
1065
1066    try testing.expectEqual(@as(u32, 0x87315576), Crc32Base91D.hash("123456789"));
1067
1068    var c = Crc32Base91D.init();
1069    c.update("1234");
1070    c.update("56789");
1071    try testing.expectEqual(@as(u32, 0x87315576), c.final());
1072}
1073
1074test "CRC-32/BZIP2" {
1075    const Crc32Bzip2 = crc.Crc32Bzip2;
1076
1077    try testing.expectEqual(@as(u32, 0xfc891918), Crc32Bzip2.hash("123456789"));
1078
1079    var c = Crc32Bzip2.init();
1080    c.update("1234");
1081    c.update("56789");
1082    try testing.expectEqual(@as(u32, 0xfc891918), c.final());
1083}
1084
1085test "CRC-32/CD-ROM-EDC" {
1086    const Crc32CdRomEdc = crc.Crc32CdRomEdc;
1087
1088    try testing.expectEqual(@as(u32, 0x6ec2edc4), Crc32CdRomEdc.hash("123456789"));
1089
1090    var c = Crc32CdRomEdc.init();
1091    c.update("1234");
1092    c.update("56789");
1093    try testing.expectEqual(@as(u32, 0x6ec2edc4), c.final());
1094}
1095
1096test "CRC-32/CKSUM" {
1097    const Crc32Cksum = crc.Crc32Cksum;
1098
1099    try testing.expectEqual(@as(u32, 0x765e7680), Crc32Cksum.hash("123456789"));
1100
1101    var c = Crc32Cksum.init();
1102    c.update("1234");
1103    c.update("56789");
1104    try testing.expectEqual(@as(u32, 0x765e7680), c.final());
1105}
1106
1107test "CRC-32/ISCSI" {
1108    const Crc32Iscsi = crc.Crc32Iscsi;
1109
1110    try testing.expectEqual(@as(u32, 0xe3069283), Crc32Iscsi.hash("123456789"));
1111
1112    var c = Crc32Iscsi.init();
1113    c.update("1234");
1114    c.update("56789");
1115    try testing.expectEqual(@as(u32, 0xe3069283), c.final());
1116}
1117
1118test "CRC-32/ISO-HDLC" {
1119    const Crc32IsoHdlc = crc.Crc32IsoHdlc;
1120
1121    try testing.expectEqual(@as(u32, 0xcbf43926), Crc32IsoHdlc.hash("123456789"));
1122
1123    var c = Crc32IsoHdlc.init();
1124    c.update("1234");
1125    c.update("56789");
1126    try testing.expectEqual(@as(u32, 0xcbf43926), c.final());
1127}
1128
1129test "CRC-32/JAMCRC" {
1130    const Crc32Jamcrc = crc.Crc32Jamcrc;
1131
1132    try testing.expectEqual(@as(u32, 0x340bc6d9), Crc32Jamcrc.hash("123456789"));
1133
1134    var c = Crc32Jamcrc.init();
1135    c.update("1234");
1136    c.update("56789");
1137    try testing.expectEqual(@as(u32, 0x340bc6d9), c.final());
1138}
1139
1140test "CRC-32/KOOPMAN" {
1141    const Crc32Koopman = crc.Crc32Koopman;
1142
1143    try testing.expectEqual(@as(u32, 0x2d3dd0ae), Crc32Koopman.hash("123456789"));
1144
1145    var c = Crc32Koopman.init();
1146    c.update("1234");
1147    c.update("56789");
1148    try testing.expectEqual(@as(u32, 0x2d3dd0ae), c.final());
1149}
1150
1151test "CRC-32/MEF" {
1152    const Crc32Mef = crc.Crc32Mef;
1153
1154    try testing.expectEqual(@as(u32, 0xd2c22f51), Crc32Mef.hash("123456789"));
1155
1156    var c = Crc32Mef.init();
1157    c.update("1234");
1158    c.update("56789");
1159    try testing.expectEqual(@as(u32, 0xd2c22f51), c.final());
1160}
1161
1162test "CRC-32/MPEG-2" {
1163    const Crc32Mpeg2 = crc.Crc32Mpeg2;
1164
1165    try testing.expectEqual(@as(u32, 0x0376e6e7), Crc32Mpeg2.hash("123456789"));
1166
1167    var c = Crc32Mpeg2.init();
1168    c.update("1234");
1169    c.update("56789");
1170    try testing.expectEqual(@as(u32, 0x0376e6e7), c.final());
1171}
1172
1173test "CRC-32/XFER" {
1174    const Crc32Xfer = crc.Crc32Xfer;
1175
1176    try testing.expectEqual(@as(u32, 0xbd0be338), Crc32Xfer.hash("123456789"));
1177
1178    var c = Crc32Xfer.init();
1179    c.update("1234");
1180    c.update("56789");
1181    try testing.expectEqual(@as(u32, 0xbd0be338), c.final());
1182}
1183
1184test "CRC-40/GSM" {
1185    const Crc40Gsm = crc.Crc40Gsm;
1186
1187    try testing.expectEqual(@as(u40, 0xd4164fc646), Crc40Gsm.hash("123456789"));
1188
1189    var c = Crc40Gsm.init();
1190    c.update("1234");
1191    c.update("56789");
1192    try testing.expectEqual(@as(u40, 0xd4164fc646), c.final());
1193}
1194
1195test "CRC-64/ECMA-182" {
1196    const Crc64Ecma182 = crc.Crc64Ecma182;
1197
1198    try testing.expectEqual(@as(u64, 0x6c40df5f0b497347), Crc64Ecma182.hash("123456789"));
1199
1200    var c = Crc64Ecma182.init();
1201    c.update("1234");
1202    c.update("56789");
1203    try testing.expectEqual(@as(u64, 0x6c40df5f0b497347), c.final());
1204}
1205
1206test "CRC-64/GO-ISO" {
1207    const Crc64GoIso = crc.Crc64GoIso;
1208
1209    try testing.expectEqual(@as(u64, 0xb90956c775a41001), Crc64GoIso.hash("123456789"));
1210
1211    var c = Crc64GoIso.init();
1212    c.update("1234");
1213    c.update("56789");
1214    try testing.expectEqual(@as(u64, 0xb90956c775a41001), c.final());
1215}
1216
1217test "CRC-64/MS" {
1218    const Crc64Ms = crc.Crc64Ms;
1219
1220    try testing.expectEqual(@as(u64, 0x75d4b74f024eceea), Crc64Ms.hash("123456789"));
1221
1222    var c = Crc64Ms.init();
1223    c.update("1234");
1224    c.update("56789");
1225    try testing.expectEqual(@as(u64, 0x75d4b74f024eceea), c.final());
1226}
1227
1228test "CRC-64/REDIS" {
1229    const Crc64Redis = crc.Crc64Redis;
1230
1231    try testing.expectEqual(@as(u64, 0xe9c6d914c4b8d9ca), Crc64Redis.hash("123456789"));
1232
1233    var c = Crc64Redis.init();
1234    c.update("1234");
1235    c.update("56789");
1236    try testing.expectEqual(@as(u64, 0xe9c6d914c4b8d9ca), c.final());
1237}
1238
1239test "CRC-64/WE" {
1240    const Crc64We = crc.Crc64We;
1241
1242    try testing.expectEqual(@as(u64, 0x62ec59e3f1a4f00a), Crc64We.hash("123456789"));
1243
1244    var c = Crc64We.init();
1245    c.update("1234");
1246    c.update("56789");
1247    try testing.expectEqual(@as(u64, 0x62ec59e3f1a4f00a), c.final());
1248}
1249
1250test "CRC-64/XZ" {
1251    const Crc64Xz = crc.Crc64Xz;
1252
1253    try testing.expectEqual(@as(u64, 0x995dc9bbdf1939fa), Crc64Xz.hash("123456789"));
1254
1255    var c = Crc64Xz.init();
1256    c.update("1234");
1257    c.update("56789");
1258    try testing.expectEqual(@as(u64, 0x995dc9bbdf1939fa), c.final());
1259}
1260
1261test "CRC-82/DARC" {
1262    const Crc82Darc = crc.Crc82Darc;
1263
1264    try testing.expectEqual(@as(u82, 0x09ea83f625023801fd612), Crc82Darc.hash("123456789"));
1265
1266    var c = Crc82Darc.init();
1267    c.update("1234");
1268    c.update("56789");
1269    try testing.expectEqual(@as(u82, 0x09ea83f625023801fd612), c.final());
1270}