Main Lemma Repository
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

SerializeCheck.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 06/16/2016 09:12:46 PM
  11. * @author Trevor Irons (ti)
  12. * @email tirons@egi.utah.edu
  13. * @copyright Copyright (c) 2016, University of Utah
  14. * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
  15. */
  16. #include <cxxtest/TestSuite.h>
  17. #include <LemmaCore>
  18. using namespace Lemma;
  19. class MyTestSuite : public CxxTest::TestSuite
  20. {
  21. public:
  22. // void test_trace(void)
  23. // {
  24. // TS_TRACE("This is a test tracing message.");
  25. // }
  26. //
  27. // void test_warn(void)
  28. // {
  29. // TS_WARN("This is a test warning message.");
  30. // }
  31. void testASCIIParser( void )
  32. {
  33. auto Obj = ASCIIParser::NewSP();
  34. YAML::Node node = Obj->Serialize();
  35. auto Obj2 = ASCIIParser::DeSerialize(node);
  36. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  37. }
  38. void testCubicSplineInterpolator(void)
  39. {
  40. auto Obj = CubicSplineInterpolator::NewSP();
  41. YAML::Node node = Obj->Serialize();
  42. auto Obj2 = CubicSplineInterpolator::DeSerialize(node);
  43. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  44. }
  45. void testRectilinearGrid( void )
  46. {
  47. auto Obj = RectilinearGrid::NewSP();
  48. YAML::Node node = Obj->Serialize();
  49. auto Obj2 = RectilinearGrid::DeSerialize(node);
  50. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  51. }
  52. void testRectilinearGridReader( void )
  53. {
  54. auto Obj = RectilinearGridReader::NewSP();
  55. YAML::Node node = Obj->Serialize();
  56. auto Obj2 = RectilinearGridReader::DeSerialize(node);
  57. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  58. }
  59. void testWindowFilter( void )
  60. {
  61. auto Obj = WindowFilter::NewSP();
  62. YAML::Node node = Obj->Serialize();
  63. auto Obj2 = WindowFilter::DeSerialize(node);
  64. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  65. }
  66. // How do we test abstract classes?
  67. // void testLayeredEarth( void )
  68. // {
  69. // std::random_device rd;
  70. // std::mt19937 gen(rd());
  71. // std::discrete_distribution<> d({0,40, 10, 10, 40});
  72. // auto Obj = LayeredEarth::NewSP();
  73. // int nl = d(gen);
  74. // Obj->SetNumberOfLayers(nl);
  75. // YAML::Node node = Obj->Serialize();
  76. // auto Obj2 = LayeredEarth::DeSerialize(node);
  77. // TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  78. // TS_ASSERT_EQUALS( Obj->GetNumberOfLayers(), Obj2->GetNumberOfLayers() );
  79. //
  80. // }
  81. // void testRectilinearGridVTKExporter( void )
  82. // {
  83. // auto Obj = RectilinearGridVTKExporter::NewSP();
  84. // TS_ASSERT_EQUALS( Obj->GetName(), std::string("RectilinearGridVTKExporter") );
  85. // }
  86. };