Skip to content
Snippets Groups Projects
Select Git revision
  • a2eecb6dd6d10c6f2d66dcaba6676df3d0bd7fb0
  • develop default protected
  • feature/advection
  • feature/composite-scheme-other-fluxes
  • origin/stage/bouguettaia
  • save_clemence
  • feature/local-dt-fsi
  • feature/variational-hydro
  • feature/gmsh-reader
  • feature/reconstruction
  • feature/kinetic-schemes
  • feature/composite-scheme-sources
  • feature/serraille
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

MeshFlatNodeBoundary.cpp

Blame
  • test_ASTNodeDeclarationToAffectationConverter.cpp 3.60 KiB
    #include <catch2/catch.hpp>
    
    #include <ASTNodeValueBuilder.hpp>
    
    #include <ASTBuilder.hpp>
    #include <ASTNodeDataTypeBuilder.hpp>
    
    #include <ASTNodeDeclarationToAffectationConverter.hpp>
    
    #include <ASTSymbolTableBuilder.hpp>
    
    #include <ASTPrinter.hpp>
    
    #define CHECK_AST(data, expected_output)                                                       \
      {                                                                                            \
        static_assert(std::is_same_v<std::decay_t<decltype(data)>, std::string_view>);             \
        static_assert(std::is_same_v<std::decay_t<decltype(expected_output)>, std::string_view>);  \
                                                                                                   \
        string_input input{data, "test.pgs"};                                                      \
        auto ast = ASTBuilder::build(input);                                                       \
                                                                                                   \
        ASTSymbolTableBuilder{*ast};                                                               \
        ASTNodeDataTypeBuilder{*ast};                                                              \
        ASTNodeValueBuilder{*ast};                                                                 \
                                                                                                   \
        ASTNodeDeclarationToAffectationConverter{*ast};                                            \
                                                                                                   \
        std::stringstream ast_output;                                                              \
        ast_output << '\n' << ASTPrinter{*ast, ASTPrinter::Format::raw, {ASTPrinter::Info::none}}; \
                                                                                                   \
        REQUIRE(ast_output.str() == expected_output);                                              \
      }
    
    TEST_CASE("ASTNodeDeclarationToAffectationConverter", "[language]")
    {
      SECTION("nothing to convert")
      {
        std::string_view data = R"(
    R z;
    )";
    
        std::string_view result = R"(
    (root)
     `-(language::declaration)
         +-(language::R_set)
         `-(language::name:z)
    )";
    
        CHECK_AST(data, result);
      }
    
      SECTION("simple constructor")
      {
        std::string_view data = R"(
    R z = 0;
    )";
    
        std::string_view result = R"(
    (root)
     `-(language::eq_op)
         +-(language::name:z)
         `-(language::integer:0)
    )";
    
        CHECK_AST(data, result);
      }
    
      SECTION("complex constructors")
      {
        std::string_view data = R"(