Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4866918
compilation.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
Mon, Sep 14, 1:09 AM
Size
1 KB
Mime Type
text/x-c
Expires
Wed, Sep 16, 1:09 AM (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
292607
Attached To
rXR Xreate
compilation.cpp
View Options
#include "passmanager.h"
#include "gtest/gtest.h"
using namespace xreate;
//TEST FunctionUnit::compileInline
TEST(Compilation, DISABLED_functionInline1){
}
//DEBT implement no pkgconfig ways to link libs
TEST(Compilation, Sequence1){
PassManager* man = PassManager::prepareForCode(
"interface(extern-c){\n"
" libFake = library:: pkgconfig(\"libxml-2.0\").\n"
" \n"
" include {\n"
" libFake = [\"stdio.h\", \"stdlib.h\"]\n"
" }.\n"
"}"
"main = function:: int; entry {\n"
" sequence ["
" printf(\"FIRST-\"),\n"
" printf(\">SECOND\")\n"
" ]"
"}"
);
int (*main)() = (int (*)()) man->run();
testing::internal::CaptureStdout();
main();
std::string output = testing::internal::GetCapturedStdout();
ASSERT_STREQ("FIRST->SECOND", output.c_str());
}
TEST(Compilation, full_IFStatementWithVariantType){
PassManager* man = PassManager::prepareForCode(
"COLORS = type variant (RED, BLUE, GREEN).\n"
"\n"
" main = function(x::int):: int; entry {\n"
" color = if (x == 0 )::COLORS {RED} else {BLUE}.\n"
" if (color == BLUE)::int {1} else {0}\n"
" }"
);
int (*main)(int) = (int (*)(int)) man->run();
ASSERT_EQ(0, main(0));
ASSERT_EQ(1, main(1));
}
// "main = function:: int; entry {\n"
// " context:: expectNoErrors. "
// " buf1 = \"aaaaa\"::string.\n"
// " buf2 = \"aaaaa\"::string.\n"
// " sequence ["
// " sprintf(buf1, \"%d\", exec(\"bazaar --version\")),"
// " sprintf(buf2, \"%d\", exec(\"svn --version\")),"
// " printf(buf1),\n"
// " printf(buf2)\n"
// "]"
// "}"
Event Timeline
Log In to Comment