Ejemplo n.º 1
0
        public void APITest_restrictions_restrictionsAll_acc_range7b()
        {
            string    path = tmpFile("range7b");
            SkillFile sf   = SkillFile.open(path, Mode.Create, Mode.Write);

            // create objects
            restrictionsAll.RangeBoarderCases rbc = (restrictionsAll.RangeBoarderCases)sf.RangeBoarderCasess().make();
            // set fields
            rbc.negative  = (int)0;
            rbc.negative2 = (long)0L;
            rbc.degrees2  = (double)(double)0.001;
            rbc.positive2 = (short)(short)0;
            rbc.positive  = (sbyte)(sbyte)0;
            rbc.degrees   = (float)(float)0.001;
            sf.close();

            { // read back and assert correctness
                SkillFile sf2 = SkillFile.open(sf.currentPath(), Mode.Read, Mode.ReadOnly);
                // check count per Type
                Assert.AreEqual(1, sf.RangeBoarderCasess().staticSize());
                // create objects from file
                restrictionsAll.RangeBoarderCases rbc_2 = (restrictionsAll.RangeBoarderCases)sf2.RangeBoarderCasess().getByID(rbc.SkillID);
                // assert fields
                Assert.IsTrue(rbc_2.negative == 0);
                Assert.IsTrue(rbc_2.negative2 == 0L);
                Assert.IsTrue(rbc_2.degrees2 == (double)0.001);
                Assert.IsTrue(rbc_2.positive2 == (short)0);
                Assert.IsTrue(rbc_2.positive == (sbyte)0);
                Assert.IsTrue(rbc_2.degrees == (float)0.001);
            }
            File.Delete(path);
        }
Ejemplo n.º 2
0
        public void APITest_core_restrictionsAll_acc_example()
        {
            string    path = tmpFile("example");
            SkillFile sf   = SkillFile.open(path, Mode.Create, Mode.Write);

            // create objects
            restrictionsAll.Operator            op   = (restrictionsAll.Operator)sf.Operators().make();
            restrictionsAll.RangeBoarderCases   rbc  = (restrictionsAll.RangeBoarderCases)sf.RangeBoarderCasess().make();
            restrictionsAll.DefaultBoarderCases dbc  = (restrictionsAll.DefaultBoarderCases)sf.DefaultBoarderCasess().make();
            restrictionsAll.None            none_obj = (restrictionsAll.None)sf.Nones().make();
            restrictionsAll.ZSystem         sys_obj  = (restrictionsAll.ZSystem)sf.ZSystems().make();
            restrictionsAll.Term            trm      = (restrictionsAll.Term)sf.Terms().make();
            restrictionsAll.RegularProperty rp       = (restrictionsAll.RegularProperty)sf.RegularPropertys().make();
            restrictionsAll.Comment         cmnt     = (restrictionsAll.Comment)sf.Comments().make();
            // set fields
            op.name = (string)"Minus";

            rbc.negative  = (int)0;
            rbc.negative2 = (long)0L;
            rbc.degrees2  = (double)(double)360;
            rbc.positive2 = (short)(short)0;
            rbc.positive  = (sbyte)(sbyte)0;
            rbc.degrees   = (float)(float)0;

            dbc.system     = ([email protected])sys_obj;
            dbc.nopDefault = (long)0L;
            dbc.none       = (Properties)none_obj;
            dbc.Zfloat     = (float)(float)-1;
            dbc.message    = (string)"Hello World!";


            sys_obj.name    = (string)"Hexadecimal";
            sys_obj.version = (float)(float)1.1;

            trm.arguments = (System.Collections.ArrayList)array <Term>(trm, (Term)null);
            trm.Zoperator = (Operator)op;


            cmnt.property = (Properties)sys_obj;
            cmnt.text     = (string)"A comment";
            cmnt.target   = ([email protected])op;
            sf.close();

            { // read back and assert correctness
                SkillFile sf2 = SkillFile.open(sf.currentPath(), Mode.Read, Mode.ReadOnly);
                // check count per Type
                Assert.AreEqual(1, sf.DefaultBoarderCasess().staticSize());
                Assert.AreEqual(1, sf.ZSystems().staticSize());
                Assert.AreEqual(1, sf.Operators().staticSize());
                Assert.AreEqual(1, sf.RangeBoarderCasess().staticSize());
                Assert.AreEqual(1, sf.Comments().staticSize());
                Assert.AreEqual(1, sf.Nones().staticSize());
                Assert.AreEqual(1, sf.RegularPropertys().staticSize());
                Assert.AreEqual(1, sf.Terms().staticSize());
                // create objects from file
                restrictionsAll.Operator            op_2   = (restrictionsAll.Operator)sf2.Operators().getByID(op.SkillID);
                restrictionsAll.RangeBoarderCases   rbc_2  = (restrictionsAll.RangeBoarderCases)sf2.RangeBoarderCasess().getByID(rbc.SkillID);
                restrictionsAll.DefaultBoarderCases dbc_2  = (restrictionsAll.DefaultBoarderCases)sf2.DefaultBoarderCasess().getByID(dbc.SkillID);
                restrictionsAll.None            none_obj_2 = (restrictionsAll.None)sf2.Nones().getByID(none_obj.SkillID);
                restrictionsAll.ZSystem         sys_obj_2  = (restrictionsAll.ZSystem)sf2.ZSystems().getByID(sys_obj.SkillID);
                restrictionsAll.Term            trm_2      = (restrictionsAll.Term)sf2.Terms().getByID(trm.SkillID);
                restrictionsAll.RegularProperty rp_2       = (restrictionsAll.RegularProperty)sf2.RegularPropertys().getByID(rp.SkillID);
                restrictionsAll.Comment         cmnt_2     = (restrictionsAll.Comment)sf2.Comments().getByID(cmnt.SkillID);
                // assert fields
                Assert.IsTrue(op_2.name != null && op_2.name.Equals("Minus"));

                Assert.IsTrue(rbc_2.negative == 0);
                Assert.IsTrue(rbc_2.negative2 == 0L);
                Assert.IsTrue(rbc_2.degrees2 == (double)360);
                Assert.IsTrue(rbc_2.positive2 == (short)0);
                Assert.IsTrue(rbc_2.positive == (sbyte)0);
                Assert.IsTrue(rbc_2.degrees == (float)0);

                Assert.IsTrue(dbc_2.nopDefault == 0L);
                Assert.IsTrue(dbc_2.none == none_obj_2);
                Assert.IsTrue(dbc_2.Zfloat == (float)-1);
                Assert.IsTrue(dbc_2.message != null && dbc_2.message.Equals("Hello World!"));


                Assert.IsTrue(sys_obj_2.name != null && sys_obj_2.name.Equals("Hexadecimal"));
                Assert.IsTrue(sys_obj_2.version == (float)1.1);

                Assert.IsTrue(trm_2.arguments != null && ArrayListEqual(trm_2.arguments, array <Term>(trm_2, (Term)null)));
                Assert.IsTrue(trm_2.Zoperator == op_2);


                Assert.IsTrue(cmnt_2.property == sys_obj_2);
                Assert.IsTrue(cmnt_2.text != null && cmnt_2.text.Equals("A comment"));
                Assert.IsTrue(cmnt_2.target == op_2);
            }
            File.Delete(path);
        }