Skip to content

Commit

Permalink
ModeloAmplio tiene método aplica_comando()
Browse files Browse the repository at this point in the history
  • Loading branch information
autosquash committed Jan 2, 2024
1 parent b58f712 commit 41f625d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modelo_amplio.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "general.h"

struct DatosNivel;
struct Comando;

class ModeloAmplio {
private:
Expand All @@ -12,4 +13,10 @@ class ModeloAmplio {
FaseNivel get_fase_actual() { return estado.fase_actual; }
ModeloAmplio(const DatosNivel &datos_nivel)
: estado(FaseNivel::MostrandoInstrucciones, datos_nivel) {}

FaseNivel aplica_comando( //
const Comando &comando //
) {
return FaseNivel::Saliendo;
}
};
8 changes: 8 additions & 0 deletions src/tests/modelo/test_modelo_amplio.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include "../../comandos.h"
#include "../../datos_nivel.h"
#include "../../modelo_amplio.h"
#include <cassert>
Expand All @@ -14,3 +15,10 @@ TEST(ModeloAmplio, ModeloAmplioEmpiezaMostrandoInstrucciones) {
modelo_amplio.get_fase_actual(), FaseNivel::MostrandoInstrucciones
);
}
TEST(ModeloAmplio, ModeloAmplioAplicaComandoSalir) {
const std::string instrucciones = "test instrucciones";
const DatosNivel datos_nivel;
ModeloAmplio modelo_amplio(datos_nivel);
const auto result = modelo_amplio.aplica_comando(Comando::Salir{});
EXPECT_EQ(result, FaseNivel::Saliendo);
}

0 comments on commit 41f625d

Please sign in to comment.