CMapFormatTest.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * CMapFormatTest.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 <boost/test/unit_test.hpp>
  12. #include "../lib/mapping/CMap.h"
  13. #include "../lib/rmg/CMapGenOptions.h"
  14. #include "../lib/rmg/CMapGenerator.h"
  15. static const int TEST_RANDOM_SEED = 1337;
  16. static CMap * initialMap;
  17. class CMapTestFixture
  18. {
  19. public:
  20. CMapTestFixture()
  21. {
  22. CMapGenOptions opt;
  23. opt.setHeight(72);
  24. opt.setWidth(72);
  25. opt.setHasTwoLevels(false);
  26. opt.setPlayerCount(2);
  27. CMapGenerator gen;
  28. initialMap = gen.generate(&opt, TEST_RANDOM_SEED).release();
  29. };
  30. ~CMapTestFixture()
  31. {
  32. delete initialMap;
  33. };
  34. };
  35. BOOST_GLOBAL_FIXTURE(CMapTestFixture);
  36. BOOST_AUTO_TEST_CASE(CMapFormatVCMI_Simple)
  37. {
  38. try
  39. {
  40. //TODO: serialize map
  41. //TODO: deserialize map
  42. //TODO: compare results
  43. }
  44. catch(const std::exception & e)
  45. {
  46. logGlobal-> errorStream() << e.what();
  47. throw;
  48. }
  49. }