Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4866837
DFGtests.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
Sun, Sep 13, 10:40 PM
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Sep 15, 10:40 PM (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
292619
Attached To
rXR Xreate
DFGtests.cpp
View Options
/*
* DFGtests.cpp
*
* Created on: Jul 23, 2015
* Author: pgess
*/
#include "passmanager.h"
#include "pass/dfgpass.h"
#include "gtest/gtest.h"
using namespace xreate;
using namespace std;
TEST(DFG, testFunctionRetSymbolExists){
PassManager* man = PassManager::prepareForCode
("test = function():: int; entry {\n"
" data = [1..5]::[int].\n"
" \n"
" result = loop fold(data->i::int, 0->sum::int)::int{\n"
" if (i==3)::int {valNull = null. valNull} else {i+sum}\n"
" }.\n"
" \n"
" result\n"
"}");
man->runWithoutCompilation();
ClaspLayer::ModelFragment answer = man->clasp->query(Config::get("clasp.ret.symbol"));
if (answer)
EXPECT_EQ(1, std::distance(answer->first, answer->second));
for (auto functionIt = answer->first; functionIt != answer->second; ++functionIt){
auto ret = ClaspLayer::parse<string, Gringo::Value>(functionIt->second);
ASSERT_EQ("test", std::get<0>(ret));
SymbolPacked symbolRet = std::get<0>(ClaspLayer::parse<SymbolPacked>(std::get<1>(ret)));
ASSERT_EQ(3, symbolRet.identifier);
ASSERT_EQ(0, symbolRet.scope);
}
}
Event Timeline
Log In to Comment