diff --git a/include/characters/artefactoUnico.hpp b/include/characters/artefactoUnico.hpp index 180a722..9a52f73 100644 --- a/include/characters/artefactoUnico.hpp +++ b/include/characters/artefactoUnico.hpp @@ -83,6 +83,11 @@ class ArtefactoUnico : public EntidadGenerica { return m_durability <= 0.0; } + + std::string nombre() const + { + return this->m_name; + } }; #endif // ARTEFACTOUNICO_HPP diff --git a/include/characters/caravana.hpp b/include/characters/caravana.hpp new file mode 100644 index 0000000..22bef5c --- /dev/null +++ b/include/characters/caravana.hpp @@ -0,0 +1,50 @@ +#ifndef CARAVAN_HPP +#define CARAVAN_HPP + +#include "artefactoUnico.hpp" +#include "entidadGenerica.hpp" +#include +#include +#include + +/** + * @class Caravana + * @brief Representa a los comerciantes itinerantes de artefactos únicos. + * + * La caravana viaja por el yermo ofreciendo artículos extremadamente raros a precios elevados. + */ +class Caravana : public EntidadGenerica +{ +private: + std::vector> m_stock; ///< Lista de artefactos únicos disponibles + bool m_confia; ///< Confianza en el refugio + +public: + /** + * @brief Constructor + * @param nombre Nombre de la caravana + * @param confia Indica si la caravana está dispuesta a comerciar + */ + Caravana(const std::string& nombre, bool confia); + /** + * @brief Muestra el inventario de la caravana + */ + void showInfo() const override; + + /** + * @brief Intenta comprar un artefacto + * @param nombre Nombre del artefacto + * @return Puntero al artefacto si se realizó la transacción, nullptr en caso contrario + */ + std::shared_ptr comprarArtefacto(const std::string& nombre); + + /** + * @brief Simula una evaluación de confianza futura + */ + void evaluarConfianza(); + +private: + void inicializarStock(); +}; + +#endif // CARAVAN_HPP diff --git a/include/characters/chracterVisitant.hpp b/include/characters/chracterVisitant.hpp new file mode 100644 index 0000000..022754b --- /dev/null +++ b/include/characters/chracterVisitant.hpp @@ -0,0 +1,51 @@ +// +// Created by gvalenzuela on 3/30/25. +// + +#ifndef CHRACTERVISITANT_HPP +#define CHRACTERVISITANT_HPP + +#include "characters/artefactoUnico.hpp" +#include "characters/asaltante.hpp" +#include "characters/caravana.hpp" +#include "characters/enclave.hpp" +#include "characters/ghoul.hpp" +#include "characters/hermanosDeAcero.hpp" +#include "characters/mercader.hpp" +#include "characters/mercaderAgua.hpp" +#include "characters/mutantes.hpp" +#include "characters/refugiado.hpp" +#include "characters/refugio.hpp" +#include "characters/saqueador.hpp" + +using VisitanteVariant = std::variant< +Refugiado, +Mercader, +MercaderAgua, +Saqueador, +HermanoAcero, +Enclave, +Mutante, +Asaltante, +Ghoul, +Caravana +>; + +namespace NPC { + enum class VisitantCategory + { + REFUGEE, + BROTHER, + ENEMY, + MERCHANT, + CARAVAN + }; + + struct VisitantChance + { + VisitantCategory type; + double weight; + }; +}; + +#endif //CHRACTERVISITANT_HPP diff --git a/include/characters/enclave.hpp b/include/characters/enclave.hpp index 67e5f30..7fc4e0f 100644 --- a/include/characters/enclave.hpp +++ b/include/characters/enclave.hpp @@ -24,78 +24,41 @@ class Enclave : public EntidadGenerica * @brief Constructor * @param nombre Nombre del escuadrón */ - explicit Enclave(const std::string& nombre) - : EntidadGenerica(nombre) - , m_fuerza(generarFuerza()) - , m_potencia(generarPotencia()) - , m_detectado(false) - { - } + explicit Enclave(const std::string& nombre); /** * @brief Muestra información de la escuadra ENCLAVE */ - void showInfo() const override - { - std::cout << "💂🏻 ENCLAVE - Escuadrón: " << m_name << "\n" - << " - Soldados: " << m_fuerza << "\n" - << " - Potencia táctica: " << m_potencia << "\n" - << " - ¿Han detectado el refugio?: " << (m_detectado ? "Sí" : "No") << "\n"; - } + void showInfo() const override; /** * @brief Simula la detección del refugio */ - void detectarRefugio() - { - m_detectado = true; - std::cout << "💬 " << m_name << " >>> Objetivo confirmado. Preparando ofensiva." << std::endl; - } + void detectarRefugio(); /** * @brief Devuelve si la escuadra ya ha detectado el refugio */ - bool haDetectado() const - { - return m_detectado; - } + bool haDetectado() const; /** * @brief Devuelve la fuerza de combate */ - int fuerza() const - { - return m_fuerza; - } - + int fuerza() const; /** * @brief Devuelve la potencia de ataque */ - double potencia() const - { - return m_potencia; - } + double potencia() const; private: /** * @brief Genera aleatoriamente una cantidad de soldados entre 10 y 50 */ - int generarFuerza() const - { - static std::mt19937 rng(std::random_device {}()); - std::uniform_int_distribution dist(10, 50); - return dist(rng); - } - + int generarFuerza(); /** * @brief Genera aleatoriamente un valor de potencia entre 2.5 y 5.0 */ - double generarPotencia() const - { - static std::mt19937 rng(std::random_device {}()); - std::uniform_real_distribution dist(2.5, 5.0); - return dist(rng); - } + double generarPotencia() const; }; #endif // ENCLAVE_HPP diff --git a/include/characters/hermanosDeAcero.hpp b/include/characters/hermanosDeAcero.hpp new file mode 100644 index 0000000..920862c --- /dev/null +++ b/include/characters/hermanosDeAcero.hpp @@ -0,0 +1,94 @@ +#ifndef HERMANO_ACERO_HPP +#define HERMANO_ACERO_HPP + +#include "entidadGenerica.hpp" +#include + +/** + * @class HermanoAcero + * @brief Representa a un miembro de la Hermandad del Acero. + * + * Poseen entrenamiento militar avanzado y pueden usar artefactos únicos. + * Requieren muchos recursos y son estrictos con su permanencia en un refugio. + */ +class HermanoAcero : public EntidadGenerica +{ +private: + int m_entrenamiento; ///< Nivel de entrenamiento (impacta en defensa del refugio) + double m_suministros; ///< Recursos necesarios para mantenerlo + bool m_enRefugio; ///< Si actualmente vive en un refugio + int m_consumoMinimo; ///< Cuántos recursos necesita por turno + +public: + /** + * @brief Constructor + * @param nombre Nombre del miembro + * @param entrenamiento Nivel de habilidad (100 por defecto) + */ + HermanoAcero(const std::string& nombre, int entrenamiento = 100) + : EntidadGenerica(nombre) + , m_entrenamiento(entrenamiento) + , m_suministros(0.20f) // 20% de los suministros del refugio + , m_enRefugio(false) + , m_consumoMinimo(20) // el doble de lo estándar + { + } + + /** + * @brief Muestra información del hermano del acero + */ + void showInfo() const override + { + std::cout << "⚙️ Hermano del Acero: " << m_name << "\n" + << " - Nivel de entrenamiento: " << m_entrenamiento << "\n" + << " - Suministros actuales: " << m_suministros << "\n" + << " - En refugio: " << (m_enRefugio ? "Sí" : "No") << "\n"; + } + + /** + * @brief Intenta ingresar al refugio + * @param recursosDisponibles Recursos disponibles del refugio + * @return Recursos consumidos, o 0 si no fue aceptado + */ + int solicitarIngreso(int recursosDisponibles) + { + if (recursosDisponibles >= m_consumoMinimo) + { + m_enRefugio = true; + std::cout << "💬" << m_name << " >>> Por la tecnología, serviré a este refugio." << std::endl; + return m_consumoMinimo; + } + else + { + std::cout << "💬" << m_name << " >>> Sus recursos no están a la altura de la Hermandad." << std::endl; + return 0; + } + } + + /** + * @brief Consume recursos cada ciclo, si no hay suficientes abandona el refugio + */ + void consumir() + { + if (m_suministros >= m_consumoMinimo) + { + m_suministros -= m_consumoMinimo; + std::cout << "💬" << m_name << " >>> Reabastecido. Listo para defender." << std::endl; + } + else + { + m_enRefugio = false; + std::cout << "💬" << m_name << " >>> Sin suministros. Este refugio no merece protección." << std::endl; + } + } + + /** + * @brief Saber si está aún en el refugio + */ + bool estaEnRefugio() const + { + return m_enRefugio; + } +}; + +#endif // HERMANO_ACERO_HPP diff --git a/include/dataStructures/queue.hpp b/include/dataStructures/queue.hpp new file mode 100644 index 0000000..b72fac6 --- /dev/null +++ b/include/dataStructures/queue.hpp @@ -0,0 +1,88 @@ +#ifndef QUEUE_HPP +#define QUEUE_HPP + +#include + + +/** + * @brief Estructura de datos tipo Cola (FIFO - First In, First Out) + * + * @tparam TData Tipo de dato almacenado en la cola + */ +template +class Queue +{ +private: + /** + * @brief Nodo de la cola + */ + struct Node + { + TData data; ///< Dato almacenado + Node* next; ///< Puntero al siguiente nodo + + explicit Node(const TData& value) + : data(value) + , next(nullptr) + { + } + }; + + Node* m_front; ///< Puntero al primer elemento + Node* m_rear; ///< Puntero al último elemento + size_t m_size; ///< Cantidad de elementos en la cola + +public: + /** + * @brief Constructor por defecto + */ + Queue(); + + /** + * @brief Destructor: libera todos los nodos de la cola + */ + ~Queue(); + + /** + * @brief Inserta un elemento al final de la cola + * + * @param value Valor a insertar + */ + void enqueue(const TData& value); + /** + * @brief Elimina el primer elemento de la cola + * + * @throws std::underflow_error si la cola está vacía + */ + void dequeue(); + + /** + * @brief Devuelve el primer elemento sin eliminarlo + * + * @return TData Primer valor en la cola + * @throws std::underflow_error si la cola está vacía + */ + TData front() const; + + /** + * @brief Verifica si la cola está vacía + * + * @return true si no hay elementos + * @return false si hay al menos un elemento + */ + bool isEmpty() const; + /** + * @brief Devuelve la cantidad de elementos en la cola + * + * @return size_t tamaño de la cola + */ + size_t getSize() const; + + void print_all(); + + void printHead(); + + void clear(); +}; + +#endif // QUEUE_HPP diff --git a/include/dataStructures/stack.hpp b/include/dataStructures/stack.hpp new file mode 100644 index 0000000..9400480 --- /dev/null +++ b/include/dataStructures/stack.hpp @@ -0,0 +1,93 @@ +#ifndef STACK_HPP +#define STACK_HPP + +#include +#include + +/** + * @brief Estructura de datos tipo Pila (LIFO - Last In, First Out) + * + * @tparam TData Tipo de dato almacenado en la pila + */ +template +class Stack +{ +private: + /** + * @brief Nodo de la pila + */ + struct Node + { + TData data; ///< Valor almacenado + Node* next; ///< Puntero al siguiente nodo + + Node(const TData& data, Node* next = nullptr) + : data(data) + , next(next) + { + } + }; + + Node* m_top; ///< Puntero al nodo superior (cima) + size_t m_size; ///< Cantidad de elementos en la pila + +public: + /** + * @brief Constructor por defecto + */ + Stack(); + + /** + * @brief Destructor: libera todos los nodos + */ + ~Stack(); + + /** + * @brief Agrega un elemento en la cima de la pila + * + * @param value Valor a insertar + */ + void push(const TData& value); + + /** + * @brief Elimina el elemento superior de la pila + * + * @throws std::underflow_error si la pila está vacía + */ + void pop(); + + /** + * @brief Devuelve una referencia al elemento superior (mutable) + * + * @return TData& referencia al valor + * @throws std::underflow_error si la pila está vacía + */ + TData& top(); + + /** + * @brief Devuelve una referencia constante al elemento superior + * + * @return const TData& referencia constante al valor + * @throws std::underflow_error si la pila está vacía + */ + const TData& top() const; + + /** + * @brief Verifica si la pila está vacía + * + * @return true si no hay elementos + * @return false si hay al menos un elemento + */ + bool isEmpty() const; + + /** + * @brief Devuelve la cantidad de elementos en la pila + * + * @return size_t tamaño de la pila + */ + size_t size() const; + + void print(); +}; + +#endif // STACK_HPP \ No newline at end of file diff --git a/src/caravana.cpp b/src/caravana.cpp new file mode 100644 index 0000000..09f470b --- /dev/null +++ b/src/caravana.cpp @@ -0,0 +1,58 @@ +#include + + +Caravana::Caravana(const std::string& nombre, bool confia) + : EntidadGenerica(nombre) + , m_confia(confia) +{ + inicializarStock(); +} + + +void Caravana::showInfo() const +{ + std::cout << "🚚 Caravana: " << m_name << "\n"; + std::cout << " - Confianza: " << (m_confia ? "Sí" : "No") << "\n"; + std::cout << " - Artefactos disponibles:\n"; + for (const auto& item : this->m_stock) + { + item->showInfo(); + } +} + +std::shared_ptr Caravana::comprarArtefacto(const std::string& nombre) +{ + if (!m_confia) + { + std::cout << "💬 " << m_name << " >>> No confiamos lo suficiente en tu refugio para hacer negocios." + << std::endl; + return nullptr; + } + + for (auto it = m_stock.begin(); it != m_stock.end(); ++it) + { + if ((*it)->nombre() == nombre) + { + std::cout << "💬 " << m_name << " >>> Excelente elección. Espero que lo uses bien." << std::endl; + auto item = *it; + m_stock.erase(it); + return item; + } + } + + std::cout << "💬 " << m_name << " >>> No tenemos ese artefacto en este momento." << std::endl; + return nullptr; +} + +void Caravana::evaluarConfianza() +{ + this->m_confia = true; // Lógica temporal, puede depender del nivel del refugio +} + +void Caravana::inicializarStock() +{ + m_stock.emplace_back(std::make_shared("Detector de Radiación", "Épico", EngineData::UniqueArtifactType::TECHNOLOGY, 250.0)); + m_stock.emplace_back(std::make_shared("Pistola Láser Táctica", "Legendaria", EngineData::UniqueArtifactType::WEAPON, 400.0)); + m_stock.emplace_back(std::make_shared("Batería de Fusión", "Rara", EngineData::UniqueArtifactType::TECHNOLOGY, 320.0)); + +} \ No newline at end of file diff --git a/src/enclave.cpp b/src/enclave.cpp new file mode 100644 index 0000000..fccee8a --- /dev/null +++ b/src/enclave.cpp @@ -0,0 +1,52 @@ +#include "enclave.hpp" + +Enclave::Enclave(const std::string& nombre) + : EntidadGenerica(nombre) + , m_fuerza(generarFuerza()) + , m_potencia(generarPotencia()) + , m_detectado(false) +{ +} + +void Enclave::showInfo() const +{ + std::cout << "💂🏻 ENCLAVE - Escuadrón: " << m_name << "\n" + << " - Soldados: " << m_fuerza << "\n" + << " - Potencia táctica: " << m_potencia << "\n" + << " - ¿Han detectado el refugio?: " << (m_detectado ? "Sí" : "No") << "\n"; +} + +void Enclave::detectarRefugio() +{ + m_detectado = true; + std::cout << "💬 " << m_name << " >>> Objetivo confirmado. Preparando ofensiva." << std::endl; +} + +bool Enclave::haDetectado() const +{ + return m_detectado; +} + +int Enclave::fuerza() const +{ + return m_fuerza; +} + +double Enclave::potencia() const +{ + return m_potencia; +} + +int Enclave::generarFuerza() +{ + static std::mt19937 rng(std::random_device {}()); + std::uniform_int_distribution dist(10, 50); + return dist(rng); +} + +double Enclave::generarPotencia() const +{ + static std::mt19937 rng(std::random_device {}()); + std::uniform_real_distribution dist(2.5, 5.0); + return dist(rng); +}; \ No newline at end of file diff --git a/src/event.cpp b/src/event.cpp new file mode 100644 index 0000000..415f5c7 --- /dev/null +++ b/src/event.cpp @@ -0,0 +1,42 @@ +#include +#include "queue.hpp" + +class Event +{ + private: + struct Evento + { + int event_id; + std::string m_name; + std::string m_type; + }; + + Queue m_eventosPendientes; + + public: + + void NewEvent(const Evento& evento) + { + m_eventosPendientes.enqueue(evento); + } + + void check() + { + std::cout<<"Ingrese 1 para ver el evento acutal. 0 para ver todos los eventos"; + int num ; + std::cin >> num ; + + if(num == 1) + { + m_eventosPendientes.printHead(); + }else if(num == 0) + { + m_eventosPendientes.print_all(); + m_eventosPendientes.clear(); + }else + { + std::cout<<"Numero ingresado incorrecto" ; + } + + } +}; diff --git a/src/history.cpp b/src/history.cpp new file mode 100644 index 0000000..d47ace2 --- /dev/null +++ b/src/history.cpp @@ -0,0 +1,36 @@ +#include "stack.hpp" +#include + +class History +{ + private: + struct Action + { + int accion_id; + std::string type; + std::string character; + + }; + Stack m_historialDecisiones; + + public: + void registerDecision(const Action& accion) + { + m_historialDecisiones.push(accion); + } + + void history() + { + std::cout<< "A continuacion se mostrara las acciones realizadas " << "\n"; + m_historialDecisiones.print(); + } + + //elimina la ultima accione + void undo() + { + m_historialDecisiones.pop(); + } + + + +}; \ No newline at end of file diff --git a/src/queue.cpp b/src/queue.cpp new file mode 100644 index 0000000..993e087 --- /dev/null +++ b/src/queue.cpp @@ -0,0 +1,101 @@ +#include "queue.hpp" +#include + + +template +Queue::Queue() + : m_front(nullptr) + , m_rear(nullptr) + , m_size(0) + { + } + +template +Queue::~Queue() +{ + clear(); +} + +template +void Queue::enqueue(const TData& value) +{ + Node* newNode = new Node(value); + if (isEmpty()) + { + m_front = newNode; + m_rear = newNode; + } + else + { + m_rear->next = newNode; + m_rear = newNode; + } + ++m_size; +} + +template +void Queue::dequeue() +{ + if(isEmpty()) + { + throw std::underflow_error("Queue is empty"); + } + auto temp = new Node(); + temp = m_front; + m_front = m_front->next; + delete temp; + --m_size; +} + +template +TData Queue::front() const +{ + if (isEmpty()) + { + throw std::underflow_error("Queue is empty"); + } + return m_front->data; +} + +template +bool Queue::isEmpty() const +{ + return m_size == 0; +} + + +template +size_t Queue::getSize() const +{ + return m_size; +} + +template +void Queue::print_all() +{ + Node* temp = m_front; + while (temp != nullptr) + { + std::cout << temp->data << "\n"; + temp = temp->next; + } +} + +template +void Queue::printHead() +{ + if (!isEmpty()) + { + std::cout << m_front->data << "\n"; + } +} + +template +void Queue::clear() +{ + while (!isEmpty()) + { + dequeue(); + } + +} \ No newline at end of file diff --git a/src/stack.cpp b/src/stack.cpp new file mode 100644 index 0000000..5f244d8 --- /dev/null +++ b/src/stack.cpp @@ -0,0 +1,82 @@ +#include "stack.hpp" + + +template +Stack::Stack() + : m_top(nullptr) + , m_size(0) +{ +} + +template +Stack::~Stack() +{ + while (!isEmpty()) + { + pop(); + } +} + +template +void Stack::push(const TData& value) +{ + Node* newNode = new Node(value, m_top); + m_top = newNode; + ++m_size; +} + +template +void Stack::pop() +{ + if (isEmpty()) + { + throw std::underflow_error("Stack is empty"); + } + Node* temp = m_top; + m_top = m_top->next; + delete temp; + --m_size; +} + +template +TData& Stack::top() +{ + if (isEmpty()) + { + throw std::underflow_error("Stack is empty"); + } + return m_top->data; +} + +template +const TData& Stack::top() const +{ + if (isEmpty()) + { + throw std::underflow_error("Stack is empty"); + } + return m_top->data; +} + +template +bool Stack::isEmpty() const +{ + return m_size == 0; +} + +template +size_t Stack::size() const +{ + return m_size; +} + +template +void Stack::print() +{ + Node* temp = m_top; + while(temp != nullptr) + { + std::cout<< temp->data << "\n"; + temp = temp->next; + } +} diff --git a/tests/unit/list_test.cpp b/tests/unit/list_test.cpp new file mode 100644 index 0000000..9b47c59 --- /dev/null +++ b/tests/unit/list_test.cpp @@ -0,0 +1,69 @@ +#include +#include "list.hpp" + + +TEST(LinkedListTest, PushFrontAndPrint) { + LinkedList list; + list.push_front(3); + list.push_front(2); + list.push_front(1); + EXPECT_EQ(list.take(0, 3)->data, 1); +} + +TEST(LinkedListTest, RemoveAt) { + LinkedList list; + list.push_front(3); + list.push_front(2); + list.push_front(1); + list.remove_at(1); + EXPECT_EQ(list.take(0, 2)->next->data, 3); +} + +TEST(LinkedListTest, TakeWithinBounds) { + LinkedList list; + for (int i = 0; i < 5; ++i) + list.push_front(5 - i); + auto newList = list.take(1, 3); + EXPECT_EQ(newList->data, 2); + EXPECT_EQ(newList->next->data, 3); + EXPECT_EQ(newList->next->next->data, 4); +} + +TEST(DoublyLinkedListTest, PushBackAndPrint) { + DoublyLinkedList list; + list.push_back(1); + list.push_back(2); + list.push_back(3); + EXPECT_EQ(list.get_head()->data, 1); + EXPECT_EQ(list.get_head()->next->data, 2); + EXPECT_EQ(list.get_head()->next->next->data, 3); +} + +TEST(DoublyLinkedListTest, PushFront) { + DoublyLinkedList list; + list.push_front(1); + list.push_front(2); + EXPECT_EQ(list.get_head()->data, 2); + EXPECT_EQ(list.get_head()->next->data, 1); +} + +TEST(DoublyLinkedListTest, RemoveAt) { + DoublyLinkedList list; + list.push_back(1); + list.push_back(2); + list.push_back(3); + list.remove_at(1); + EXPECT_EQ(list.get_head()->next->data, 3); +} + +TEST(DoublyLinkedListTest, CopyList) { + DoublyLinkedList list1; + list1.push_back(1); + list1.push_back(2); + + DoublyLinkedList list2; + list2.copy_list(list1); + + EXPECT_EQ(list2.get_head()->data, 1); + EXPECT_EQ(list2.get_head()->next->data, 2); +} diff --git a/tests/unit/queue_test.cpp b/tests/unit/queue_test.cpp new file mode 100644 index 0000000..74f74eb --- /dev/null +++ b/tests/unit/queue_test.cpp @@ -0,0 +1,35 @@ + +#include +#include "queue.hpp" + + +TEST(QueueTest, EnqueueDequeueFront) { + Queue q; + EXPECT_TRUE(q.isEmpty()); + q.enqueue(10); + q.enqueue(20); + EXPECT_EQ(q.front(), 10); + q.dequeue(); + EXPECT_EQ(q.front(), 20); + q.dequeue(); + EXPECT_TRUE(q.isEmpty()); +} + +TEST(QueueTest, DequeueOnEmptyThrows) { + Queue q; + EXPECT_THROW(q.dequeue(), std::underflow_error); +} + +TEST(QueueTest, FrontOnEmptyThrows) { + Queue q; + EXPECT_THROW(q.front(), std::underflow_error); +} + +TEST(QueueTest, QueueSize) { + Queue q; + q.enqueue("A"); + q.enqueue("B"); + EXPECT_EQ(q.getSize(), 2); + q.dequeue(); + EXPECT_EQ(q.getSize(), 1); +} diff --git a/tests/unit/stack_test.cpp b/tests/unit/stack_test.cpp new file mode 100644 index 0000000..0d157e5 --- /dev/null +++ b/tests/unit/stack_test.cpp @@ -0,0 +1,34 @@ + +#include +#include "stack.hpp" + + +TEST(StackTest, PushPopTop) { + Stack s; + EXPECT_TRUE(s.isEmpty()); + s.push(42); + EXPECT_FALSE(s.isEmpty()); + EXPECT_EQ(s.top(), 42); + s.pop(); + EXPECT_TRUE(s.isEmpty()); +} + +TEST(StackTest, PopOnEmptyThrows) { + Stack s; + EXPECT_THROW(s.pop(), std::underflow_error); +} + +TEST(StackTest, TopOnEmptyThrows) { + Stack s; + EXPECT_THROW(s.top(), std::underflow_error); +} + +TEST(StackTest, StackSize) { + Stack s; + s.push("uno"); + s.push("dos"); + s.push("tres"); + EXPECT_EQ(s.size(), 3); + s.pop(); + EXPECT_EQ(s.size(), 2); +}