コード例 #1
0
 public void Positionne_expression_2()
 {
     var tmp = new OperandeVariable(intId, "nom");
       var ope = new OperatorExpression(tmp, OPERATOR.PLUS);
       ope.Expression2 = tmp;
       Assert.AreEqual(tmp, ope.Expression2);
 }
コード例 #2
0
 public void Doit_retourner_deux_plus_inputs_pour_methode()
 {
     OperandeVariable operande = new OperandeVariable(classId, "var1");
       cla.AddMethod("method", classId, new List<IArgument>() { registry.CreateArgument(classId)});
       IExpression v = new MethodExpression(operande, registry.GetClassById(classId).InstanceMethods[0]);
       Assert.AreEqual(3, v.Count);
 }
コード例 #3
0
 public void Positionne_l_expression_en_expression2()
 {
     var intVar2 = new OperandeVariable(intId, "num2");
       var tmp = new OperatorExpression(intVar, OPERATOR.EQUAL);
       tmp = (OperatorExpression)tmp.Set(2, intVar2);
       Assert.AreSame(intVar2, tmp.Expression2);
 }
コード例 #4
0
 public void Jete_exception_quand_appel_method_egal()
 {
     var tmp = new OperandeVariable(intId, "nom");
       intClass.AddMethod("method", intId, new List<IArgument>() { registry.CreateArgument(intId) });
       var tmp2 = new MethodExpression(tmp, intClass.InstanceMethods[0]);
       new OperatorExpression(tmp2, OPERATOR.EQUAL);
 }
コード例 #5
0
 public void Positionne_l_expression_en_deuxième_argument()
 {
     var intVar2 = new OperandeVariable(intId, "num2");
       MethodExpression method = new MethodExpression(intVar, intClass.InstanceMethods[0]);
       var tmp = (MethodExpression)method.Set(3, intVar2);
       Assert.AreSame(intVar2, tmp.Inputs[1]);
 }
コード例 #6
0
 public void Doit_avoir_3_elements()
 {
     var tmpVar = new OperandeVariable(classId, "maVariable");
       var tmp = new OperatorExpression(tmpVar, OPERATOR.EQUAL);
       var visitor = new VisualisationVisitor(ref registry);
       List<IElement> lst = visitor.Visit(tmp);
       Assert.AreEqual(3, lst.Count);
 }
コード例 #7
0
 public void Doit_avoir_5_elements()
 {
     var tmpVar = new OperandeVariable(classId, "maVariable");
       var tmp = new MethodExpression(tmpVar, registry.GetClassById(classId).InstanceMethods[0]);
       var visitor = new VisualisationVisitor(ref registry);
       List<IElement> lst = visitor.Visit(tmp);
       Assert.AreEqual(5, lst.Count);
 }
コード例 #8
0
 public void Doit_changer_l_element_visé_par_la_position()
 {
     var intVar2 = new OperandeVariable(intId, "num2");
       MethodExpression method = new MethodExpression(intVar, intClass.InstanceMethods[0]);
       method = (MethodExpression)method.Set(3, intVar2);
       MethodExpression method2 = new MethodExpression(intVar2, intClass.InstanceMethods[0]);
       method = (MethodExpression)method.Set(3, method2);
       Assert.AreSame(method2, method.Inputs[1]);
 }
コード例 #9
0
 public void Positionne_l_expression_en_deuxième_expression_de_expression2()
 {
     var intVar2 = new OperandeVariable(intId, "num2");
       var ope2 = new OperatorExpression(intVar2, OPERATOR.EQUAL);
       var ope1 = new OperatorExpression(intVar, OPERATOR.EQUAL);
       ope1 = (OperatorExpression)ope1.Set(2, ope2);
       ope1 = (OperatorExpression)ope1.Set(4, intVar2);
       Assert.AreSame(intVar2, ((OperatorExpression)ope1.Expression2).Expression2);
 }
コード例 #10
0
        public void Doit_retourner_id_class_que_operation()
        {
            var visitor = new ReturnVisitor(ref registry);

              var tmp = new OperandeVariable(classId, "num");
              var tmp2 = new OperatorExpression(tmp, OPERATOR.EQUAL);

              Assert.AreEqual(classId, visitor.Visit(tmp2));
        }
コード例 #11
0
 public void Doit_ajouter_les_inputs()
 {
     cla.AddMethod("method2", classId, new List<IArgument>() { registry.CreateArgument(classId), registry.CreateArgument(classId) });
       var tmpVar = new OperandeVariable(classId, "maVariable");
       var tmp = new MethodExpression(tmpVar, registry.GetClassById(classId).InstanceMethods[1]);
       tmp = (MethodExpression)tmp.Set(2, tmpVar);
       tmp = (MethodExpression)tmp.Set(3, tmpVar);
       var visitor = new VisualisationVisitor(ref registry);
       List<IElement> lst = visitor.Visit(tmp);
       Assert.AreEqual(7, lst.Count);
 }
コード例 #12
0
        public void Init()
        {
            registry = RegistrySingleton.Instance;
              registry.ClearClasses();

              intId = registry.AddPrimitiveClass("numeric", DATA_TYPE.NUMERIC);
              intClass = registry.GetClassById(intId);
              intClass.AddMethod("method", intId, new List<IArgument>() { registry.CreateArgument(intId), registry.CreateArgument(intId) });

              intVar = new OperandeVariable(intId, "num");
        }
コード例 #13
0
 public void Doit_avoir_des_positions_croissantes()
 {
     var tmpVar = new OperandeVariable(classId, "maVariable");
       var tmp = new MethodExpression(tmpVar, registry.GetClassById(classId).InstanceMethods[0]);
       var visitor = new VisualisationVisitor(ref registry);
       List<IElement> lst = visitor.Visit(tmp);
       for(int i = 0; i<lst.Count; i++)
       {
     Assert.AreEqual(i, lst[i].Position);
       }
 }
コード例 #14
0
        public void Doit_retourner_id_class_que_methode()
        {
            var visitor = new ReturnVisitor(ref registry);

              var tmpId = registry.AddPrimitiveClass("string", DATA_TYPE.STRING);
              cla.AddMethod("method", tmpId, new System.Collections.Generic.List<ClassesRegistry.Method.Argument.IArgument>());

              var tmp = new OperandeVariable(classId, "num");
              var tmp2 = new MethodExpression(tmp, registry.GetClassById(classId).InstanceMethods[0]);

              Assert.AreEqual(tmpId, visitor.Visit(tmp2));
        }
コード例 #15
0
        public void Doit_retourner_id_boolean_pour_operateur_AND_OR_ARE_EQUAL()
        {
            var visitor = new ReturnVisitor(ref registry);

              var tmp3 = registry.AddPrimitiveClass("boolean", DATA_TYPE.BOOLEAN);
              var tmp = new OperandeVariable(classId, "num");
              var tmp2 = new OperatorExpression(tmp, OPERATOR.AND);
              Assert.AreEqual(tmp3, visitor.Visit(tmp2));
              tmp2 = new OperatorExpression(tmp, OPERATOR.OR);
              Assert.AreEqual(tmp3, visitor.Visit(tmp2));
              tmp2 = new OperatorExpression(tmp, OPERATOR.ARE_EQUAL);
              Assert.AreEqual(tmp3, visitor.Visit(tmp2));
        }
コード例 #16
0
 public void Doit_retourner_un_pour_variable()
 {
     IExpression v = new OperandeVariable(classId, "var1");
       Assert.AreEqual(1, v.Count);
 }
コード例 #17
0
 public void Doit_retourner_trois_pour_operateur()
 {
     OperandeVariable operande = new OperandeVariable(classId, "var1");
       IExpression v = new OperatorExpression(operande, OPERATOR.EQUAL);
       Assert.AreEqual(3, v.Count);
 }
コード例 #18
0
 public void Jete_exception_quand_operation_egal()
 {
     var tmp = new OperandeVariable(intId, "nom");
       var tmp2 = new OperatorExpression(tmp, OPERATOR.EQUAL);
       new OperatorExpression(tmp2, OPERATOR.EQUAL);
 }
コード例 #19
0
 public void Positionne_l_expression_de_gauche()
 {
     var intVar = new OperandeVariable(intId, "nom");
       var ope = new OperatorExpression(intVar, OPERATOR.PLUS);
       Assert.AreEqual(intVar, ope.Expression1);
 }
コード例 #20
0
        public void Init()
        {
            registry = RegistrySingleton.Instance;
              registry.ClearClasses();

              classId = registry.AddPrimitiveClass("numeric", DATA_TYPE.NUMERIC);
              cla = registry.GetClassById(classId);
              newVar = new OperandeVariable(classId, "myVar", true);
        }
コード例 #21
0
 public void Doit_retourner_id_class_que_variable()
 {
     var visitor = new ReturnVisitor(ref registry);
       var tmp = new OperandeVariable(classId, "num");
       Assert.AreEqual(classId, visitor.Visit(tmp));
 }
コード例 #22
0
 public void Positionne_type_d_operation()
 {
     var intVar = new OperandeVariable(intId, "nom");
       var ope = new OperatorExpression(intVar, OPERATOR.PLUS);
       Assert.AreEqual(OPERATOR.PLUS, ope.Operator);
 }