test/unit-hashtable.cc
// Test suite for basic nontransactional put and get functionality
Test suite for basic nontransactional put and get functionality
Test suite for basic nontransactional put and get functionality
void testBasicNontransPutGet() {
    typedef Hashtable<Hashtable_params<int, int>> ht_type;
    ht_type ht;
    {
        ht.nontrans_put(1, 42);
        int* vp = ht.nontrans_get(1);
        assert(vp);
        assert(*vp == 42);
    }
    {
        int* vp = ht.nontrans_get(42);
        assert(!vp);
    }
    {
        ht.nontrans_put(1, 9001);
        int* vp = ht.nontrans_get(1);
        assert(vp);
        assert(*vp == 9001);
    }
    {
        ht.nontrans_put(1776, 74);
        int* vp = ht.nontrans_get(1776);
        assert(vp);
        assert(*vp == 74);
    }
    printf("PASS: %s\n", __FUNCTION__);
}
void testBasicNontransPutGet ( ) { typedef Hashtable < Hashtable_params < int , int > > ht_type ; ht_type ht ; { ht . nontrans_put ( 1 , 42 ) ; int * vp = ht . nontrans_get ( 1 ) ; assert ( vp ) ; assert ( * vp == 42 ) ; } { int * vp = ht . nontrans_get ( 42 ) ; assert ( ! vp ) ; } { ht . nontrans_put ( 1 , 9001 ) ; int * vp = ht . nontrans_get ( 1 ) ; assert ( vp ) ; assert ( * vp == 9001 ) ; } { ht . nontrans_put ( 1776 , 74 ) ; int * vp = ht . nontrans_get ( 1776 ) ; assert ( vp ) ; assert ( * vp == 74 ) ; } printf ( " \n " , __FUNCTION__ ) ; }
Test suite for basic nontransactional put and get functionality
Test suite for basic nontransactional put and get functionality
// Test putting and getting the same element // Test getting an absent element // Test overwriting and existing element // Test putting and getting a new element