Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F3995597
CFGtests.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 7, 4:13 PM
Size
1 KB
Mime Type
text/x-c++
Expires
Thu, Jul 9, 4:13 PM (1 d, 20 m)
Engine
blob
Format
Raw Data
Handle
271674
Attached To
rXR Xreate
CFGtests.cpp
View Options
/*
* testsCFG.cpp
*
* Created on: Jul 17, 2015
* Author: pgess
*/
#include "passmanager.h"
#include "pass/dfgpass.h"
#include "gtest/gtest.h"
using namespace xreate;
using namespace std;
TEST(CFG, testFunctionAnnotationsClasp){
string&& program =
"f2 = function()::int; annotationF2 {\n"
" 0\n"
"}\n"
"\n"
"f1 = function():: int; entry; annotationF1 {\n"
" f2() + 10\n"
"}";
PassManager* man = PassManager::prepareForCode(move(program));
man->runWithoutCompilation();
ClaspLayer::ModelFragment answer = man->clasp->query("annotationF1");
int countNoneValue = 0;
if (answer)
countNoneValue = std::distance(answer->first, answer->second);
EXPECT_EQ(1, countNoneValue);
answer = man->clasp->query("annotationF2");
countNoneValue = 0;
if (answer)
countNoneValue = std::distance(answer->first, answer->second);
EXPECT_EQ(1, countNoneValue);
}
TEST(CFG, testLoopContextExists){
PassManager* man = PassManager::prepareForCode (
"interface(cfa){\n"
" operator fold:: annotation1.\n"
"}\n"
"\n"
"main = function() :: int; entry {\n"
" x = [1..10]:: [int].\n"
" sum = loop fold (x->el:: int, 0->sum:: int):: [int] {\n"
" el + sum + f1()\n"
" }. \n"
" sum\n"
"}"
"f1 = function()::int {\n"
" x = 0:: int. "
" x\n"
"}"
);
man->runWithoutCompilation();
}
Event Timeline
Log In to Comment