-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTable.cpp
More file actions
50 lines (47 loc) · 2.95 KB
/
Copy pathTestTable.cpp
File metadata and controls
50 lines (47 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* ------------------------------------------------------------------------------------ *
* *
* EPITECH PROJECT - Sat, Feb, 2026 *
* Title - Santas_Headache *
* Description - *
* TestToys *
* *
* ------------------------------------------------------------------------------------ *
* *
* ███████╗██████╗ ██╗████████╗███████╗ ██████╗██╗ ██╗ *
* ██╔════╝██╔══██╗██║╚══██╔══╝██╔════╝██╔════╝██║ ██║ *
* █████╗ ██████╔╝██║ ██║ █████╗ ██║ ███████║ *
* ██╔══╝ ██╔═══╝ ██║ ██║ ██╔══╝ ██║ ██╔══██║ *
* ███████╗██║ ██║ ██║ ███████╗╚██████╗██║ ██║ *
* ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚═════╝╚═╝ ╚═╝ *
* *
* ------------------------------------------------------------------------------------ */
#include <iostream>
#include "src/object/toy/Toy.hpp"
#include "src/object/toy/Teddy.hpp"
#include "src/object/toy/LittlePony.hpp"
#include "src/object/Object.hpp"
#include "src/table/ITable.hpp"
#include "src/table/PapaXMasTable.hpp"
#include <gtest/gtest.h>
TEST(TestTables, testTable)
{
Toy toy = Toy();
LittlePony littlePony = LittlePony();
Teddy teddy = Teddy();
ITable* table = new PapaXMasTable();
Object* toys[3];
toys[0] = &toy;
toys[1] = &littlePony;
toys[2] = &teddy;
toys[0]->isTaken();
toys[1]->isTaken();
toys[2]->isTaken();
table->putOnTable(toys[0]);
table->putOnTable(toys[1]);
table->putOnTable(toys[2]);
Object** objects = table->getObjects();
std::cout << *table->takeFromTable(0) << std::endl;
for (int i = 0; objects[i] != nullptr; i++) {
std::cout << "Object n°" << i + 1 << ": " << (objects[i] == nullptr ? "nullptr" : objects[i]->getTaken() ? "taken" : "not taken") << std::endl;
}
}