#include <coral/lang/SMD01/SMD01.h>
#include <coral/lang/SMD01/create_coral_language.h>
#include <coral/core/Element.h>
#include <coral/core/ElementDefinition.h>

int main() {
	coral::Element* lang = (*SMD01::Language)();
	coral::Element* pack = (*SMD01::Package)();
	coral_assert(pack);
	coral_assert(lang);

	coral::Atom* a = pack->__getSlotOneElement__("name");
	coral_assert(a);
	a->__setString__("MyPackage");
	lang->__getSlotOneElement__("name")->__setString__("MyLanguage");
	lang->__getSlotOneElement__("version")->__setIValue__(4);
	lang->__getSlotOneElement__("revision")->__setIValue__(6);
	lang->__getSlotByName__("packages")->add(pack);

	coral::Element* e1 = (*SMD01::ElementDefinition)();
	coral::Element* e2 = (*SMD01::ElementDefinition)();
	coral::Element* e3 = (*SMD01::ElementDefinition)();

	coral::Element* p1 = (*SMD01::Property)();
	p1->__getSlotOneElement__("name")->__setString__("p1");
	p1->__getSlotByName__("owner")->insert(e1);
	p1->__getSlotByName__("element_kind")->insert(e2);

	coral::Element* p2 = (*SMD01::Property)();
	p2->__getSlotOneElement__("name")->__setString__("p2");
	p2->__getSlotByName__("owner")->insert(e2);
	p2->__getSlotByName__("element_kind")->insert(e1);

	e1->__getSlotOneElement__("name")->__setString__("E1");
	e2->__getSlotOneElement__("name")->__setString__("E2");
	e3->__getSlotOneElement__("name")->__setString__("E3");
	pack->__getSlotByName__("elements")->add(e1);
	pack->__getSlotByName__("elements")->add(e2);
	lang->__getSlotByName__("elements")->add(e3);

	lang->__getSlotByName__("root_ed")->insert(e3);

	SMD01::CreateCoralLang s(lang);
	coral::Language* theLanguage = s.getNewLanguage();

	coral_assert(theLanguage);
}
