implemented database tests. once case failing(don't know if i found a bug or the test is wrong, will seet to this later