Added tests to tableLookupTest.cpp and fixed bugs in tableLookup.c