ERM_GM_T.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * ERM_GM_T.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include <vcmi/events/GenericEvents.h>
  12. #include "../scripting/ScriptFixture.h"
  13. namespace test
  14. {
  15. namespace scripting
  16. {
  17. using namespace ::testing;
  18. class ERM_GM_T : public Test, public ScriptFixture
  19. {
  20. public:
  21. protected:
  22. void SetUp() override
  23. {
  24. ScriptFixture::setUp();
  25. }
  26. };
  27. TEST_F(ERM_GM_T, NewGame)
  28. {
  29. std::stringstream source;
  30. source << "VERM" << std::endl;
  31. source << "!?GM0;" << std::endl;
  32. source << "!!VRv42:S4;" << std::endl;
  33. source << "!?PI;" << std::endl;
  34. source << "!!VRv43:S4;" << std::endl;
  35. loadScript(VLC->scriptHandler->erm, source.str());
  36. SCOPED_TRACE("\n" + subject->code);
  37. runClientServer();
  38. events::GameResumed::defaultExecute(&eventBus);
  39. const JsonNode actualState = context->saveState();
  40. EXPECT_EQ(actualState["ERM"]["v"]["42"], JsonUtils::floatNode(4)) << actualState.toJson();
  41. }
  42. }
  43. }