scool r57: Add tests on concepts

URL: https://svn.lrde.epita.fr/svn/scool/trunk ChangeLog: 2008-04-10 Maxime van Noppen <yabo@lrde.epita.fr> Add tests on concepts * transformer/class_dec.ref, * transformer/class_decl_2.ref, * transformer/class_decl_3.ref: Minor layout change. * input/concept_2.scl: New. * input/concept_3.scl: New. * input/concept_4.scl: New. * parser/concept_1.ref: New. * parser/concept_2.ref: New. * parser/concept_3.ref: New. * parser/concept_4.ref: New. * transformer/concept_1.ref: New. * transformer/concept_2.ref: New. * transformer/concept_3.ref: New. * transformer/concept_4.ref: New. input/concept_2.scl | 6 ++++++ input/concept_3.scl | 7 +++++++ input/concept_4.scl | 8 ++++++++ parser/concept_1.ref | 1 + parser/concept_2.ref | 1 + parser/concept_3.ref | 1 + parser/concept_4.ref | 1 + transformer/class_dec.ref | 1 - transformer/class_decl_2.ref | 1 - transformer/class_decl_3.ref | 1 - transformer/concept_1.ref | 18 ++++++++++++++++++ transformer/concept_2.ref | 18 ++++++++++++++++++ transformer/concept_3.ref | 21 +++++++++++++++++++++ transformer/concept_4.ref | 24 ++++++++++++++++++++++++ 14 files changed, 106 insertions(+), 3 deletions(-) Index: trunk/tests/input/concept_2.scl =================================================================== --- trunk/tests/input/concept_2.scl (revision 0) +++ trunk/tests/input/concept_2.scl (revision 57) @@ -0,0 +1,6 @@ +box : concept = +{ + value : type; + + decl set_value : (val : value) -> value; +} Index: trunk/tests/input/concept_3.scl =================================================================== --- trunk/tests/input/concept_3.scl (revision 0) +++ trunk/tests/input/concept_3.scl (revision 57) @@ -0,0 +1,7 @@ +box : concept = +{ + value : type; + + decl set_value : (val : value) -> value; + decl get_value : () -> value; +} Index: trunk/tests/input/concept_4.scl =================================================================== --- trunk/tests/input/concept_4.scl (revision 0) +++ trunk/tests/input/concept_4.scl (revision 57) @@ -0,0 +1,8 @@ +box : concept = +{ + value : type; + + decl set_value : (val : value) -> value; + decl get_value : () -> value; + decl print_value : () -> void; +} Index: trunk/tests/transformer/class_decl_2.ref =================================================================== --- trunk/tests/transformer/class_decl_2.ref (revision 56) +++ trunk/tests/transformer/class_decl_2.ref (revision 57) @@ -8,7 +8,6 @@ { return x; } - private: int x; int y; Index: trunk/tests/transformer/class_decl_3.ref =================================================================== --- trunk/tests/transformer/class_decl_3.ref (revision 56) +++ trunk/tests/transformer/class_decl_3.ref (revision 57) @@ -8,7 +8,6 @@ { return x; } - private: int x; int y; Index: trunk/tests/transformer/class_dec.ref =================================================================== --- trunk/tests/transformer/class_dec.ref (revision 56) +++ trunk/tests/transformer/class_dec.ref (revision 57) @@ -8,7 +8,6 @@ { return x; } - private: int x; int y; Index: trunk/tests/transformer/concept_1.ref =================================================================== --- trunk/tests/transformer/concept_1.ref (revision 0) +++ trunk/tests/transformer/concept_1.ref (revision 57) @@ -0,0 +1,18 @@ +template < typename E > +class box +{ + // To be provided by classes that models this concept + + // typedef value; + // value get_value(); + protected: + box(); +}; + +template < typename E > +box<E>::box() +{ + typedef typename E::value value; + value (E::*m1)() = &E::get_value; + m1 = 0; +} Index: trunk/tests/transformer/concept_2.ref =================================================================== --- trunk/tests/transformer/concept_2.ref (revision 0) +++ trunk/tests/transformer/concept_2.ref (revision 57) @@ -0,0 +1,18 @@ +template < typename E > +class box +{ + // To be provided by classes that models this concept + + // typedef value; + // value set_value(value val); + protected: + box(); +}; + +template < typename E > +box<E>::box() +{ + typedef typename E::value value; + value (E::*m1)(const value& val) = &E::set_value; + m1 = 0; +} Index: trunk/tests/transformer/concept_3.ref =================================================================== --- trunk/tests/transformer/concept_3.ref (revision 0) +++ trunk/tests/transformer/concept_3.ref (revision 57) @@ -0,0 +1,21 @@ +template < typename E > +class box +{ + // To be provided by classes that models this concept + + // typedef value; + // value set_value(value val); + // value get_value(); + protected: + box(); +}; + +template < typename E > +box<E>::box() +{ + typedef typename E::value value; + value (E::*m1)(const value& val) = &E::set_value; + m1 = 0; + value (E::*m2)() = &E::get_value; + m2 = 0; +} Index: trunk/tests/transformer/concept_4.ref =================================================================== --- trunk/tests/transformer/concept_4.ref (revision 0) +++ trunk/tests/transformer/concept_4.ref (revision 57) @@ -0,0 +1,24 @@ +template < typename E > +class box +{ + // To be provided by classes that models this concept + + // typedef value; + // value set_value(value val); + // value get_value(); + // void print_value(); + protected: + box(); +}; + +template < typename E > +box<E>::box() +{ + typedef typename E::value value; + value (E::*m1)(const value& val) = &E::set_value; + m1 = 0; + value (E::*m2)() = &E::get_value; + m2 = 0; + void (E::*m3)() = &E::print_value; + m3 = 0; +} Index: trunk/tests/parser/concept_1.ref =================================================================== --- trunk/tests/parser/concept_1.ref (revision 0) +++ trunk/tests/parser/concept_1.ref (revision 57) @@ -0,0 +1 @@ +Program([Concept("box",[ConstDec([],"value",None,Var("type")),ConstDec(["decl"],"get_value",None,FunType([],Var("value")))])]) Index: trunk/tests/parser/concept_2.ref =================================================================== --- trunk/tests/parser/concept_2.ref (revision 0) +++ trunk/tests/parser/concept_2.ref (revision 57) @@ -0,0 +1 @@ +Program([Concept("box",[ConstDec([],"value",None,Var("type")),ConstDec(["decl"],"set_value",None,FunType([FunArg("val",Var("value"))],Var("value")))])]) Index: trunk/tests/parser/concept_3.ref =================================================================== --- trunk/tests/parser/concept_3.ref (revision 0) +++ trunk/tests/parser/concept_3.ref (revision 57) @@ -0,0 +1 @@ +Program([Concept("box",[ConstDec([],"value",None,Var("type")),ConstDec(["decl"],"set_value",None,FunType([FunArg("val",Var("value"))],Var("value"))),ConstDec(["decl"],"get_value",None,FunType([],Var("value")))])]) Index: trunk/tests/parser/concept_4.ref =================================================================== --- trunk/tests/parser/concept_4.ref (revision 0) +++ trunk/tests/parser/concept_4.ref (revision 57) @@ -0,0 +1 @@ +Program([Concept("box",[ConstDec([],"value",None,Var("type")),ConstDec(["decl"],"set_value",None,FunType([FunArg("val",Var("value"))],Var("value"))),ConstDec(["decl"],"get_value",None,FunType([],Var("value"))),ConstDec(["decl"],"print_value",None,FunType([],Var("void")))])]) -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ Président de Prologin \_____)
participants (1)
-
Maxime van Noppen