URL:
https://svn.lrde.epita.fr/svn/scool/branches/scool-ng
ChangeLog:
2009-02-12 Matthieu Martin <matthieu.mar(a)gmail.com>
Add and fix tests.
* examples/c++_ast/container_1.aterm: New.
* examples/c++_build/container_1.g++: New.
* examples/c++_build/sample_1.g++: New.
* examples/c++_src/container_1.cc: New.
* examples/scool_ast/container_1.aterm: Here.
* examples/scool_ast/point1d.aterm: New.
* examples/scool_src/container_1.scl: Fix.
---
c++_ast/container_1.aterm | 1 +
c++_src/container_1.cc | 16 ++++++++++++++++
scool_ast/container_1.aterm | 2 +-
scool_ast/point1d.aterm | 1 +
scool_src/container_1.scl | 2 +-
5 files changed, 20 insertions(+), 2 deletions(-)
Index: branches/scool-ng/tests/examples/c++_ast/container_1.aterm
===================================================================
--- branches/scool-ng/tests/examples/c++_ast/container_1.aterm (revision 0)
+++ branches/scool-ng/tests/examples/c++_ast/container_1.aterm (revision 144)
@@ -0,0 +1 @@
+CxxProgram([CxxClassDecl([(CxxType("typename"),"Exact"),(CxxType("typename"),CxxId("T"))],CxxId("Container"),[],[CxxPublic([CxxTypedef(CxxType("T"),CxxId("value_type")),CxxFun([],CxxType("value_type"),CxxId("get"),[],Const,[CxxExpStm(CxxKeyword("return",CxxId("value_")))]),CxxFun([],CxxType("void"),CxxId("set"),[(CxxConstType(CxxRefType(CxxType("value_type"))),CxxId("value"))],None,[CxxExpStm(CxxAssign(CxxId("value_"),CxxId("value")))])]),CxxPrivate([CxxDecl(CxxType("value_type"),CxxId("value_"))])])])
Index: branches/scool-ng/tests/examples/c++_src/container_1.cc
===================================================================
--- branches/scool-ng/tests/examples/c++_src/container_1.cc (revision 0)
+++ branches/scool-ng/tests/examples/c++_src/container_1.cc (revision 144)
@@ -0,0 +1,16 @@
+template < typename Exact, typename T >
+class Container
+{
+ public:
+ typedef T value_type;
+ value_type get() const
+ {
+ return value_;
+ }
+ void set(const value_type& value)
+ {
+ value_ = value;
+ }
+ private:
+ value_type value_;
+};
Index: branches/scool-ng/tests/examples/scool_ast/point1d.aterm
===================================================================
--- branches/scool-ng/tests/examples/scool_ast/point1d.aterm (revision 0)
+++ branches/scool-ng/tests/examples/scool_ast/point1d.aterm (revision 144)
@@ -0,0 +1 @@
+Program([ClassDefinition(Identifier("point1d"),None,None,ClassBlock([AccessBlock(Public,[TypeDefinition(None,Identifier("point_type"),StaticInitialiser(SimpleType("int"))),ConstructorDeclaration(None,ArgumentsDeclaration([]),FunctionBlock([ExpressionStatement(Assign(Identifier("x_"),Integer("0")))])),ConstructorDeclaration(None,ArgumentsDeclaration([TypedId(Identifier("x"),SimpleType("point_type"))]),FunctionBlock([ExpressionStatement(Assign(Identifier("x_"),Identifier("x")))])),FunctionDefinition(None,Identifier("get_x"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("point_type")),FunctionBlock([ReturnStatement(Identifier("x"))])),FunctionDefinition(Some("mutable"),Identifier("set_x"),FunctionType(None,ArgumentsDeclaration([TypedId(Identifier("x"),SimpleType("point_type"))]),SimpleType("point_type")),FunctionBlock([ExpressionStatement(Assign(Identifier("x_"),Identifier("x")))]))]),AccessBlock(Private,[SimpleDeclaration(Some("var"),Identifier("x_"),SimpleType("point_type"),None)])]))])
Index: branches/scool-ng/tests/examples/scool_ast/container_1.aterm
===================================================================
--- branches/scool-ng/tests/examples/scool_ast/container_1.aterm (revision 143)
+++ branches/scool-ng/tests/examples/scool_ast/container_1.aterm (revision 144)
@@ -1 +1 @@
-Program([StaticClassFunction(Identifier("Container"),ParametersDeclaration([TypedId(Identifier("T"),"type")]),None,StaticClassBlock([AccessBlock(Public,[TypeDefinition(None,Identifier("value_type"),StaticInitialiser(SimpleType("T"))),FunctionDefinition(None,Identifier("get"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("value_type")),FunctionBlock([ReturnStatement(Identifier("value"))])),FunctionDefinition(Some("mutable"),Identifier("set"),FunctionType(None,ArgumentsDeclaration([TypedId(Identifier("value"),SimpleType("value_type"))]),SimpleType("void")),FunctionBlock([ExpressionStatement(Assign(Identifier("value_"),Identifier("value")))]))]),AccessBlock(Private,[SimpleDeclaration(Some("var"),Identifier("value_"),SimpleType("value_type"),None)])]))])
+Program([StaticClassFunction(Identifier("Container"),ParametersDeclaration([TypedId(Identifier("T"),"type")]),None,StaticClassBlock([AccessBlock(Public,[TypeDefinition(None,Identifier("value_type"),StaticInitialiser(SimpleType("T"))),FunctionDefinition(None,Identifier("get"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("value_type")),FunctionBlock([ReturnStatement(Identifier("value_"))])),FunctionDefinition(Some("mutable"),Identifier("set"),FunctionType(None,ArgumentsDeclaration([TypedId(Identifier("value"),SimpleType("value_type"))]),SimpleType("void")),FunctionBlock([ExpressionStatement(Assign(Identifier("value_"),Identifier("value")))]))]),AccessBlock(Private,[SimpleDeclaration(Some("var"),Identifier("value_"),SimpleType("value_type"),None)])]))])
Index: branches/scool-ng/tests/examples/scool_src/container_1.scl
===================================================================
--- branches/scool-ng/tests/examples/scool_src/container_1.scl (revision 143)
+++ branches/scool-ng/tests/examples/scool_src/container_1.scl (revision 144)
@@ -4,7 +4,7 @@
{
value_type : type = T;
- get : () -> value_type = { -> value; }
+ get : () -> value_type = { -> value_; }
mutable set : (value : value_type) -> void = { value_ = value; }
}
Index: branches/scool-ng/tests/examples/c++_build/sample_1.g++
===================================================================
Index: branches/scool-ng/tests/examples/c++_build/container_1.g++
===================================================================