Changeset 1880 for trunk/lib


Ignore:
Timestamp:
Jan 25, 2012, 2:29:06 PM (7 years ago)
Author:
ksherdy
Message:

Added hash<1> tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/test/hash_util_test.cpp

    r1876 r1880  
    1010
    1111    uint64_t r = 0;
     12    uint32_t hash_size = 0;
    1213
    1314    print_register("b0", *(uint64_t *) b0);
     
    9798    // Length 8 (bits), Expect hash<8>, hash<1> to return equal values.
    9899    /*
    99     uint32_t hash_size = 8;
     100    hash_size = 8;
    100101    for(uint32_t idx=0;idx<sizeof(uint64_t);idx++) {
    101102
    102103        // hash<1>
    103104        r = hash<1>((uint8_t *) &b0,(uint8_t *) &b2, idx*8, 8, hash_size);
    104         cout << dec << "hash<1> = " << r << endl;
     105        cout << dec << "hash<1> = " << r << endl << endl;
    105106        cout << endl << endl;
    106107
    107108        r = hash<8>((uint8_t *) &b0,(uint8_t *) &b2, idx, 1, hash_size);
    108         cout << dec << "hash<8> = " << r << endl;
     109        cout << dec << "hash<8> = " << r << endl << endl;
    109110        cout << endl << endl;
    110111
     
    119120        // hash<1>
    120121        r = hash<1>((uint8_t *) &b1,(uint8_t *) &b2, idx*8, 16, hash_size);
    121         cout << dec << "hash<1> = " << r << endl;
     122        cout << dec << "hash<1> = " << r << endl << endl;
    122123        cout << endl << endl;
    123124
    124125        r = hash<8>((uint8_t *) &b1,(uint8_t *) &b2, idx, 2, hash_size);
    125         cout << dec << "hash<8> = " << r << endl;
     126        cout << dec << "hash<8> = " << r << endl << endl;
    126127        cout << endl << endl;
    127128
     
    130131
    131132    // Some hash<1> cases.
    132 
     133    /*
     134    hash_size = 9;
     135    for(uint32_t lgth=16;lgth<sizeof(uint64_t)*8+1;lgth+=16) {
     136        for(uint32_t idx=1;idx<sizeof(uint64_t)*8-lgth+1;idx++) {
     137             r = hash<1>((uint8_t *) &b0,(uint8_t *) &b1, idx, lgth, hash_size);
     138             cout << dec << "hash<1> = " << r << endl << endl;
     139             cout  << endl;
     140        }
     141    }
     142    */
    133143
    134144    // Some hash<8> cases.
Note: See TracChangeset for help on using the changeset viewer.