Lemma is an Electromagnetics API
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SerializeCheck.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2016, University of Utah
  15. * @copyright Copyright (c) 2016, Trevor Irons & Lemma Software, LLC
  16. */
  17. #include <cxxtest/TestSuite.h>
  18. #include <LemmaCore>
  19. using namespace Lemma;
  20. class MyTestSuite : public CxxTest::TestSuite
  21. {
  22. public:
  23. // void test_trace(void)
  24. // {
  25. // TS_TRACE("This is a test tracing message.");
  26. // }
  27. //
  28. // void test_warn(void)
  29. // {
  30. // TS_WARN("This is a test warning message.");
  31. // }
  32. void testASCIIParser( void )
  33. {
  34. auto Obj = ASCIIParser::NewSP();
  35. YAML::Node node = Obj->Serialize();
  36. auto Obj2 = ASCIIParser::DeSerialize(node);
  37. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  38. }
  39. void testCubicSplineInterpolator(void)
  40. {
  41. auto Obj = CubicSplineInterpolator::NewSP();
  42. YAML::Node node = Obj->Serialize();
  43. auto Obj2 = CubicSplineInterpolator::DeSerialize(node);
  44. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  45. }
  46. void testRectilinearGrid( void )
  47. {
  48. auto Obj = RectilinearGrid::NewSP();
  49. YAML::Node node = Obj->Serialize();
  50. auto Obj2 = RectilinearGrid::DeSerialize(node);
  51. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  52. }
  53. void testRectilinearGridReader( void )
  54. {
  55. auto Obj = RectilinearGridReader::NewSP();
  56. YAML::Node node = Obj->Serialize();
  57. auto Obj2 = RectilinearGridReader::DeSerialize(node);
  58. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  59. }
  60. void testWindowFilter( void )
  61. {
  62. auto Obj = WindowFilter::NewSP();
  63. YAML::Node node = Obj->Serialize();
  64. auto Obj2 = WindowFilter::DeSerialize(node);
  65. TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  66. }
  67. // How do we test abstract classes?
  68. // void testLayeredEarth( void )
  69. // {
  70. // std::random_device rd;
  71. // std::mt19937 gen(rd());
  72. // std::discrete_distribution<> d({0,40, 10, 10, 40});
  73. // auto Obj = LayeredEarth::NewSP();
  74. // int nl = d(gen);
  75. // Obj->SetNumberOfLayers(nl);
  76. // YAML::Node node = Obj->Serialize();
  77. // auto Obj2 = LayeredEarth::DeSerialize(node);
  78. // TS_ASSERT_EQUALS( Obj->GetName(), Obj2->GetName() );
  79. // TS_ASSERT_EQUALS( Obj->GetNumberOfLayers(), Obj2->GetNumberOfLayers() );
  80. //
  81. // }
  82. // void testRectilinearGridVTKExporter( void )
  83. // {
  84. // auto Obj = RectilinearGridVTKExporter::NewSP();
  85. // TS_ASSERT_EQUALS( Obj->GetName(), std::string("RectilinearGridVTKExporter") );
  86. // }
  87. };