Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
980637a1
Commit
980637a1
authored
Nov 10, 2020
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add very simple tests for ASTExecutionInfo
parent
cd39291d
No related branches found
No related tags found
1 merge request
!67
Feature/inline help
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/language/utils/ASTExecutionInfo.hpp
+2
-0
2 additions, 0 deletions
src/language/utils/ASTExecutionInfo.hpp
tests/test_ASTModulesImporter.cpp
+15
-1
15 additions, 1 deletion
tests/test_ASTModulesImporter.cpp
with
17 additions
and
1 deletion
src/language/utils/ASTExecutionInfo.hpp
+
2
−
0
View file @
980637a1
...
@@ -16,6 +16,8 @@ class ASTExecutionInfo
...
@@ -16,6 +16,8 @@ class ASTExecutionInfo
// The only place where the ASTExecutionInfo can be built
// The only place where the ASTExecutionInfo can be built
friend
void
parser
(
const
std
::
string
&
filename
);
friend
void
parser
(
const
std
::
string
&
filename
);
// also allowed for testing
friend
void
test_ASTExecutionInfo
(
const
ASTNode
&
,
const
ModuleRepository
&
);
ASTExecutionInfo
(
const
ASTNode
&
root_node
,
const
ModuleRepository
&
module_repository
);
ASTExecutionInfo
(
const
ASTNode
&
root_node
,
const
ModuleRepository
&
module_repository
);
...
...
This diff is collapsed.
Click to expand it.
tests/test_ASTModulesImporter.cpp
+
15
−
1
View file @
980637a1
...
@@ -4,11 +4,22 @@
...
@@ -4,11 +4,22 @@
#include
<language/ast/ASTModulesImporter.hpp>
#include
<language/ast/ASTModulesImporter.hpp>
#include
<language/ast/ASTNodeExpressionBuilder.hpp>
#include
<language/ast/ASTNodeExpressionBuilder.hpp>
#include
<language/ast/ASTNodeTypeCleaner.hpp>
#include
<language/ast/ASTNodeTypeCleaner.hpp>
#include
<language/utils/ASTExecutionInfo.hpp>
#include
<language/utils/ASTPrinter.hpp>
#include
<language/utils/ASTPrinter.hpp>
#include
<language/utils/SymbolTable.hpp>
#include
<language/utils/SymbolTable.hpp>
#include
<pegtl/string_input.hpp>
#include
<pegtl/string_input.hpp>
inline
void
test_ASTExecutionInfo
(
const
ASTNode
&
root_node
,
const
ModuleRepository
&
module_repository
)
{
ASTExecutionInfo
execution_info
{
root_node
,
module_repository
};
REQUIRE
(
&
root_node
==
&
execution_info
.
rootNode
());
REQUIRE
(
&
module_repository
==
&
execution_info
.
moduleRepository
());
REQUIRE
(
&
ASTExecutionInfo
::
current
()
==
&
execution_info
);
}
#define CHECK_AST(data, expected_output) \
#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(data)>, std::string_view>); \
...
@@ -17,10 +28,13 @@
...
@@ -17,10 +28,13 @@
string_input input{data, "test.pgs"}; \
string_input input{data, "test.pgs"}; \
auto ast = ASTBuilder::build(input); \
auto ast = ASTBuilder::build(input); \
\
\
ASTModulesImporter
{*ast};
\
ASTModulesImporter
importer{*ast};
\
ASTNodeTypeCleaner<language::import_instruction>{*ast}; \
ASTNodeTypeCleaner<language::import_instruction>{*ast}; \
\
\
ASTNodeExpressionBuilder{*ast}; \
ASTNodeExpressionBuilder{*ast}; \
const auto& module_repository = importer.moduleRepository(); \
test_ASTExecutionInfo(*ast, module_repository); \
\
ExecutionPolicy exec_policy; \
ExecutionPolicy exec_policy; \
ast->execute(exec_policy); \
ast->execute(exec_policy); \
\
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment