Example #1
0
        public void APITest_core_basicTypes_acc_all()
        {
            string    path = tmpFile("all");
            SkillFile sf   = SkillFile.open(path, Mode.Create, Mode.Write);

            // create objects
            basicTypes.BasicTypes    all = (basicTypes.BasicTypes)sf.BasicTypess().make();
            basicTypes.BasicInt64I   all_aUserType_obj_int64I_obj        = (basicTypes.BasicInt64I)sf.BasicInt64Is().make();
            basicTypes.BasicFloats   all_anotherUserType_obj             = (basicTypes.BasicFloats)sf.BasicFloatss().make();
            basicTypes.BasicIntegers all_aUserType_obj                   = (basicTypes.BasicIntegers)sf.BasicIntegerss().make();
            basicTypes.BasicInt32    all_aUserType_obj_int32_obj         = (basicTypes.BasicInt32)sf.BasicInt32s().make();
            basicTypes.BasicFloat32  all_anotherUserType_obj_float32_obj = (basicTypes.BasicFloat32)sf.BasicFloat32s().make();
            basicTypes.BasicInt64V   all_aUserType_obj_int64V_obj        = (basicTypes.BasicInt64V)sf.BasicInt64Vs().make();
            basicTypes.BasicFloat64  all_anotherUserType_obj_float64_obj = (basicTypes.BasicFloat64)sf.BasicFloat64s().make();
            basicTypes.BasicInt8     all_aUserType_obj_int8_obj          = (basicTypes.BasicInt8)sf.BasicInt8s().make();
            basicTypes.BasicInt16    all_aUserType_obj_int16_obj         = (basicTypes.BasicInt16)sf.BasicInt16s().make();
            basicTypes.BasicBool     all_aBool_obj   = (basicTypes.BasicBool)sf.BasicBools().make();
            basicTypes.BasicString   all_aString_obj = (basicTypes.BasicString)sf.BasicStrings().make();
            // set fields
            all.aUserType       = (BasicIntegers)all_aUserType_obj;
            all.aString         = (BasicString)all_aString_obj;
            all.aList           = (System.Collections.Generic.List <System.Single>)list <float>((float)3, (float)4);
            all.aMap            = (System.Collections.Generic.Dictionary <System.Int16, System.SByte>)put(map <short, sbyte>(), (short)5, (sbyte)6);
            all.anArray         = (System.Collections.ArrayList)array <BasicIntegers>(all_aUserType_obj);
            all.anAnnotation    = ([email protected])all_aBool_obj;
            all.anotherUserType = (BasicFloats)all_anotherUserType_obj;
            all.aSet            = (System.Collections.Generic.HashSet <System.SByte>)set <sbyte>((sbyte)2);
            all.aBool           = (BasicBool)all_aBool_obj;

            all_aUserType_obj_int64I_obj.basicInt = (long)0L;

            all_anotherUserType_obj.float32 = (BasicFloat32)all_anotherUserType_obj_float32_obj;
            all_anotherUserType_obj.float64 = (BasicFloat64)all_anotherUserType_obj_float64_obj;

            all_aUserType_obj.int32  = (BasicInt32)all_aUserType_obj_int32_obj;
            all_aUserType_obj.int8   = (BasicInt8)all_aUserType_obj_int8_obj;
            all_aUserType_obj.int64V = (BasicInt64V)all_aUserType_obj_int64V_obj;
            all_aUserType_obj.int64I = (BasicInt64I)all_aUserType_obj_int64I_obj;
            all_aUserType_obj.int16  = (BasicInt16)all_aUserType_obj_int16_obj;

            all_aUserType_obj_int32_obj.basicInt = (int)-1;

            all_anotherUserType_obj_float32_obj.basicFloat = (float)(float)1;

            all_aUserType_obj_int64V_obj.basicInt = (long)1L;

            all_anotherUserType_obj_float64_obj.basicFloat = (double)(double)2;

            all_aUserType_obj_int8_obj.basicInt = (sbyte)(sbyte)-3;

            all_aUserType_obj_int16_obj.basicInt = (short)(short)-2;

            all_aBool_obj.basicBool = (bool)true;

            all_aString_obj.basicString = (string)"Hello World!";
            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.BasicInt32s().staticSize());
                Assert.AreEqual(1, sf.BasicIntegerss().staticSize());
                Assert.AreEqual(1, sf.BasicFloat64s().staticSize());
                Assert.AreEqual(1, sf.BasicFloatss().staticSize());
                Assert.AreEqual(1, sf.BasicBools().staticSize());
                Assert.AreEqual(1, sf.BasicInt64Vs().staticSize());
                Assert.AreEqual(1, sf.BasicInt16s().staticSize());
                Assert.AreEqual(1, sf.BasicStrings().staticSize());
                Assert.AreEqual(1, sf.BasicInt64Is().staticSize());
                Assert.AreEqual(1, sf.BasicTypess().staticSize());
                Assert.AreEqual(1, sf.BasicInt8s().staticSize());
                Assert.AreEqual(1, sf.BasicFloat32s().staticSize());
                // create objects from file
                basicTypes.BasicTypes    all_2 = (basicTypes.BasicTypes)sf2.BasicTypess().getByID(all.SkillID);
                basicTypes.BasicInt64I   all_aUserType_obj_int64I_obj_2        = (basicTypes.BasicInt64I)sf2.BasicInt64Is().getByID(all_aUserType_obj_int64I_obj.SkillID);
                basicTypes.BasicFloats   all_anotherUserType_obj_2             = (basicTypes.BasicFloats)sf2.BasicFloatss().getByID(all_anotherUserType_obj.SkillID);
                basicTypes.BasicIntegers all_aUserType_obj_2                   = (basicTypes.BasicIntegers)sf2.BasicIntegerss().getByID(all_aUserType_obj.SkillID);
                basicTypes.BasicInt32    all_aUserType_obj_int32_obj_2         = (basicTypes.BasicInt32)sf2.BasicInt32s().getByID(all_aUserType_obj_int32_obj.SkillID);
                basicTypes.BasicFloat32  all_anotherUserType_obj_float32_obj_2 = (basicTypes.BasicFloat32)sf2.BasicFloat32s().getByID(all_anotherUserType_obj_float32_obj.SkillID);
                basicTypes.BasicInt64V   all_aUserType_obj_int64V_obj_2        = (basicTypes.BasicInt64V)sf2.BasicInt64Vs().getByID(all_aUserType_obj_int64V_obj.SkillID);
                basicTypes.BasicFloat64  all_anotherUserType_obj_float64_obj_2 = (basicTypes.BasicFloat64)sf2.BasicFloat64s().getByID(all_anotherUserType_obj_float64_obj.SkillID);
                basicTypes.BasicInt8     all_aUserType_obj_int8_obj_2          = (basicTypes.BasicInt8)sf2.BasicInt8s().getByID(all_aUserType_obj_int8_obj.SkillID);
                basicTypes.BasicInt16    all_aUserType_obj_int16_obj_2         = (basicTypes.BasicInt16)sf2.BasicInt16s().getByID(all_aUserType_obj_int16_obj.SkillID);
                basicTypes.BasicBool     all_aBool_obj_2   = (basicTypes.BasicBool)sf2.BasicBools().getByID(all_aBool_obj.SkillID);
                basicTypes.BasicString   all_aString_obj_2 = (basicTypes.BasicString)sf2.BasicStrings().getByID(all_aString_obj.SkillID);
                // assert fields
                Assert.IsTrue(all_2.aUserType == all_aUserType_obj_2);
                Assert.IsTrue(all_2.aString == all_aString_obj_2);
                Assert.IsTrue(all_2.aList != null && Enumerable.SequenceEqual(all_2.aList, list <float>((float)3, (float)4)));
                Assert.IsTrue(all_2.aMap != null && Enumerable.SequenceEqual(all_2.aMap, put(map <short, sbyte>(), (short)5, (sbyte)6)));
                Assert.IsTrue(all_2.anArray != null && ArrayListEqual(all_2.anArray, array <BasicIntegers>(all_aUserType_obj_2)));
                Assert.IsTrue(all_2.anAnnotation == all_aBool_obj_2);
                Assert.IsTrue(all_2.anotherUserType == all_anotherUserType_obj_2);
                Assert.IsTrue(all_2.aSet != null && Enumerable.SequenceEqual(all_2.aSet, set <sbyte>((sbyte)2)));
                Assert.IsTrue(all_2.aBool == all_aBool_obj_2);

                Assert.IsTrue(all_aUserType_obj_int64I_obj_2.basicInt == 0L);

                Assert.IsTrue(all_anotherUserType_obj_2.float32 == all_anotherUserType_obj_float32_obj_2);
                Assert.IsTrue(all_anotherUserType_obj_2.float64 == all_anotherUserType_obj_float64_obj_2);

                Assert.IsTrue(all_aUserType_obj_2.int32 == all_aUserType_obj_int32_obj_2);
                Assert.IsTrue(all_aUserType_obj_2.int8 == all_aUserType_obj_int8_obj_2);
                Assert.IsTrue(all_aUserType_obj_2.int64V == all_aUserType_obj_int64V_obj_2);
                Assert.IsTrue(all_aUserType_obj_2.int64I == all_aUserType_obj_int64I_obj_2);
                Assert.IsTrue(all_aUserType_obj_2.int16 == all_aUserType_obj_int16_obj_2);

                Assert.IsTrue(all_aUserType_obj_int32_obj_2.basicInt == -1);

                Assert.IsTrue(all_anotherUserType_obj_float32_obj_2.basicFloat == (float)1);

                Assert.IsTrue(all_aUserType_obj_int64V_obj_2.basicInt == 1L);

                Assert.IsTrue(all_anotherUserType_obj_float64_obj_2.basicFloat == (double)2);

                Assert.IsTrue(all_aUserType_obj_int8_obj_2.basicInt == (sbyte)-3);

                Assert.IsTrue(all_aUserType_obj_int16_obj_2.basicInt == (short)-2);

                Assert.IsTrue(all_aBool_obj_2.basicBool == true);

                Assert.IsTrue(all_aString_obj_2.basicString != null && all_aString_obj_2.basicString.Equals("Hello World!"));
            }
            File.Delete(path);
        }
Example #2
0
 /// <summary>
 /// Used for internal construction, full allocation.
 /// </summary>
 public BasicTypes(int skillID, basicTypes.BasicBool aBool, System.Collections.Generic.List <System.Single> aList, System.Collections.Generic.Dictionary <System.Int16, System.SByte> aMap, [email protected] anAnnotation, System.Collections.ArrayList anArray, basicTypes.BasicFloats anotherUserType, System.Collections.Generic.HashSet <System.SByte> aSet, basicTypes.BasicString aString, basicTypes.BasicIntegers aUserType) : base(skillID)
 {
     this.aBool           = aBool;
     this.aList           = aList;
     this.aMap            = aMap;
     this.anAnnotation    = anAnnotation;
     this.anArray         = anArray;
     this.anotherUserType = anotherUserType;
     this.aSet            = aSet;
     this.aString         = aString;
     this.aUserType       = aUserType;
 }