2024-11-27 17:14:47 +01:00
|
|
|
#include "UserTable.h"
|
|
|
|
#include "User.h"
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
// Two identical users
|
|
|
|
User u1 = User(1234, "Name Nameson");
|
|
|
|
User u2 = User(1234, "Name Nameson");
|
|
|
|
|
|
|
|
assert(u1.getName() == u2.getName());
|
|
|
|
assert(u1.getCardNbr() == u2.getCardNbr());
|
|
|
|
|
|
|
|
// Two different users
|
|
|
|
User u3 = User(1200, "Name Surname");
|
|
|
|
User u4 = User(1201, "Name Nameson");
|
|
|
|
|
|
|
|
assert(u3.getName() != u4.getName());
|
|
|
|
assert(u3.getCardNbr() != u4.getCardNbr());
|
|
|
|
|
|
|
|
UserTable ut1 = UserTable("users.txt");
|
2024-12-05 12:02:17 +01:00
|
|
|
|
|
|
|
ut1.addUser(u3);
|
|
|
|
User us = ut1.find(1200);
|
|
|
|
assert(us != UserTable::user_not_found);
|
2024-11-27 17:14:47 +01:00
|
|
|
}
|