diff --git a/tests/generator_scripts/index.yaml b/tests/generator_scripts/index.yaml index eae4c39ebe4093100a90c700b33cc8984548dd0f..b7237999332beef0de277f35e01e0285ff6f1389 100644 --- a/tests/generator_scripts/index.yaml +++ b/tests/generator_scripts/index.yaml @@ -48,6 +48,10 @@ Conditionals: - regex: if\s*\(\s*noodle\s==\sNoodles::RIGATONI\s\|\|\snoodle\s==\sNoodles::SPAGHETTI\s*\) count: 1 +NestedNamespaces: + sfg-args: + output-mode: header-only + # Kernel Generation ScaleKernel: diff --git a/tests/generator_scripts/source/NestedNamespaces.harness.cpp b/tests/generator_scripts/source/NestedNamespaces.harness.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ea7c465716a0d882b44cd6fe0a8d17c35dd94c02 --- /dev/null +++ b/tests/generator_scripts/source/NestedNamespaces.harness.cpp @@ -0,0 +1,12 @@ +#include "NestedNamespaces.hpp" + +static_assert( outer::X == 13 ); +static_assert( outer::inner::Y == 52 ); +static_assert( outer::Z == 41 ); +static_assert( outer::second_inner::W == 91 ); +static_assert( outer::inner::innermost::V == 29 ); +static_assert( GLOBAL == 42 ); + +int main() { + return 0; +} diff --git a/tests/generator_scripts/source/NestedNamespaces.py b/tests/generator_scripts/source/NestedNamespaces.py new file mode 100644 index 0000000000000000000000000000000000000000..4af7bc7b55f729157ddadbf361bc2b77db60c975 --- /dev/null +++ b/tests/generator_scripts/source/NestedNamespaces.py @@ -0,0 +1,19 @@ +from pystencilssfg import SourceFileGenerator + +with SourceFileGenerator() as sfg: + + with sfg.namespace("outer"): + sfg.code("constexpr int X = 13;") + + with sfg.namespace("inner"): + sfg.code("constexpr int Y = 52;") + + sfg.code("constexpr int Z = 41;") + + with sfg.namespace("outer::second_inner"): + sfg.code("constexpr int W = 91;") + + with sfg.namespace("outer::inner::innermost"): + sfg.code("constexpr int V = 29;") + + sfg.code("constexpr int GLOBAL = 42;")