示例#1
0
        public static void Run()
        {
            Test_SimpleStructTArray.Run();
            Test_SimpleStructTSet.Run();
            Test_SimpleStructTMap.Run();

            Test_SimpleClassTArray.Run();
            Test_SimpleClassTSet.Run();
            Test_SimpleClassTMap.Run();
        }
示例#2
0
        public static void Run()
        {
            UClass unrealClass = UClass.GetClass <Test_SimpleClassTSet>();

            Tests.Assert(unrealClass != null, "Test_SimpleClassTSet");

            Tests.AssertTSetProperty <UInt8Property>(unrealClass, "Val1");
            Tests.AssertTSetProperty <UByteProperty>(unrealClass, "Val2");
            Tests.AssertTSetProperty <UInt16Property>(unrealClass, "Val3");
            Tests.AssertTSetProperty <UUInt16Property>(unrealClass, "Val4");
            Tests.AssertTSetProperty <UIntProperty>(unrealClass, "Val5");
            Tests.AssertTSetProperty <UUInt32Property>(unrealClass, "Val6");
            Tests.AssertTSetProperty <UInt64Property>(unrealClass, "Val7");
            Tests.AssertTSetProperty <UUInt64Property>(unrealClass, "Val8");
            Tests.AssertTSetProperty <UFloatProperty>(unrealClass, "Val9");
            Tests.AssertTSetProperty <UDoubleProperty>(unrealClass, "Val10");
            //Tests.AssertTSetProperty<UDelegateProperty>(unrealClass, "Val11");
            //Tests.AssertTSetProperty<UMulticastDelegateProperty>(unrealClass, "Val12");
            Tests.AssertTSetProperty <UObjectProperty>(unrealClass, "Val13");
            Tests.AssertTSetProperty <UEnumProperty>(unrealClass, "Val14");
            Tests.AssertTSetProperty <UStructProperty>(unrealClass, "Val15");
            Tests.AssertTSetProperty <UClassProperty>(unrealClass, "Val16");
            Tests.AssertTSetProperty <ULazyObjectProperty>(unrealClass, "Val17");
            //Tests.AssertTSetProperty<UWeakObjectProperty>(unrealClass, "Val18");
            Tests.AssertTSetProperty <USoftClassProperty>(unrealClass, "Val19");
            Tests.AssertTSetProperty <USoftObjectProperty>(unrealClass, "Val20");
            Tests.AssertTSetProperty <UStrProperty>(unrealClass, "Val21");
            Tests.AssertTSetProperty <UNameProperty>(unrealClass, "Val22");
            //Tests.AssertTSetProperty<UTextProperty>(unrealClass, "Val23");

            Test_SimpleClassTSet obj = NewObject <Test_SimpleClassTSet>();

            obj.Val1.Add(100);
            Tests.Assert(obj.Val1.Contains(100), unrealClass, "Val1");
            obj.Val1.Add(101);
            Tests.Assert(obj.Val1.Contains(101), unrealClass, "Val1");
            Tests.Assert(!obj.Val1.Add(101), unrealClass, "Val1");
            Tests.AssertEqual(obj.Val1.Count, 2, unrealClass, "Val1");
            obj.Val1.Remove(101);
            Tests.AssertEqual(obj.Val1.Count, 1, unrealClass, "Val1");
            obj.Val1.Clear();
            Tests.AssertEqual(obj.Val1.Count, 0, unrealClass, "Val1");

            obj.Val2.Add(102);
            obj.Val2.Add(103);
            Tests.Assert(obj.Val2.Contains(102), unrealClass, "Val2");
            Tests.Assert(obj.Val2.Contains(102), unrealClass, "Val2");
            Tests.AssertEqual(obj.Val2.Count, 2, unrealClass, "Val2");

            obj.Val3.Add(103);
            obj.Val3.Add(104);
            Tests.Assert(obj.Val3.Contains(103), unrealClass, "Val3");
            Tests.Assert(obj.Val3.Contains(104), unrealClass, "Val3");

            obj.Val4.Add(105);
            obj.Val4.Add(106);
            Tests.Assert(obj.Val4.Contains(105), unrealClass, "Val4");
            Tests.Assert(obj.Val4.Contains(106), unrealClass, "Val4");

            obj.Val5.Add(107);
            obj.Val5.Add(108);
            Tests.Assert(obj.Val5.Contains(107), unrealClass, "Val5");
            Tests.Assert(obj.Val5.Contains(108), unrealClass, "Val5");

            obj.Val6.Add(109);
            obj.Val6.Add(110);
            Tests.Assert(obj.Val6.Contains(109), unrealClass, "Val6");
            Tests.Assert(obj.Val6.Contains(110), unrealClass, "Val6");

            obj.Val7.Add(111);
            obj.Val7.Add(112);
            Tests.Assert(obj.Val7.Contains(111), unrealClass, "Val7");
            Tests.Assert(obj.Val7.Contains(112), unrealClass, "Val7");

            obj.Val8.Add(113);
            obj.Val8.Add(114);
            Tests.Assert(obj.Val8.Contains(113), unrealClass, "Val8");
            Tests.Assert(obj.Val8.Contains(114), unrealClass, "Val8");

            obj.Val9.Add(115.5f);
            obj.Val9.Add(116.5f);
            Tests.Assert(obj.Val9.Contains(115.5f), unrealClass, "Val9");
            Tests.Assert(obj.Val9.Contains(116.5f), unrealClass, "Val9");

            obj.Val10.Add(117.2);
            obj.Val10.Add(118.2);
            Tests.Assert(obj.Val10.Contains(117.2), unrealClass, "Val10");
            Tests.Assert(obj.Val10.Contains(118.2), unrealClass, "Val10");

            Tests.Assert(!obj.Val13.Contains(Tests.ActorClass), unrealClass, "Val13");
            Tests.Assert(!obj.Val13.Contains(null), unrealClass, "Val13");
            obj.Val13.Add(Tests.ActorClass);
            obj.Val13.Add(null);
            Tests.Assert(obj.Val13.Contains(Tests.ActorClass), unrealClass, "Val13");
            Tests.Assert(obj.Val13.Contains(null), unrealClass, "Val13");

            obj.Val14.Add(Test_SimpleEnum.Val3);
            obj.Val14.Add(Test_SimpleEnum.Val2);
            Tests.Assert(obj.Val14.Contains(Test_SimpleEnum.Val3), unrealClass, "Val14");
            Tests.Assert(obj.Val14.Contains(Test_SimpleEnum.Val2), unrealClass, "Val14");

            Test_SimpleBlittableStruct blitt1 = StructDefault <Test_SimpleBlittableStruct> .Value;

            blitt1.Val1 = 10;
            blitt1.Val2 = 11;
            obj.Val15.Add(blitt1);
            obj.Val15.Add(default(Test_SimpleBlittableStruct));
            Tests.Assert(obj.Val15.Contains(blitt1), unrealClass, "Val15");
            Tests.Assert(obj.Val15.Contains(default(Test_SimpleBlittableStruct)), unrealClass, "Val15");

            obj.Val16.Add(new TSubclassOf <UObject>(Tests.ActorClass));
            obj.Val16.Add(TSubclassOf <UObject> .Null);
            Tests.Assert(obj.Val16.Contains(new TSubclassOf <UObject>(Tests.ActorClass)), unrealClass, "Val16");
            Tests.Assert(obj.Val16.Contains(TSubclassOf <UObject> .Null), unrealClass, "Val16");

            obj.Val17.Add(new TLazyObject <UObject>(Tests.ActorClass));
            obj.Val17.Add(TLazyObject <UObject> .Null);
            Tests.Assert(obj.Val17.Contains(new TLazyObject <UObject>(Tests.ActorClass)), unrealClass, "Val17");
            Tests.Assert(obj.Val17.Contains(TLazyObject <UObject> .Null), unrealClass, "Val17");

            obj.Val19.Add(new TSoftClass <UObject>(Tests.ActorClass));
            obj.Val19.Add(TSoftClass <UObject> .Null);
            Tests.Assert(obj.Val19.Contains(new TSoftClass <UObject>(Tests.ActorClass)), unrealClass, "Val19");
            Tests.Assert(obj.Val19.Contains(TSoftClass <UObject> .Null), unrealClass, "Val19");

            obj.Val20.Add(new TSoftObject <UObject>(Tests.ActorClass));
            obj.Val20.Add(TSoftObject <UObject> .Null);
            Tests.Assert(obj.Val20.Contains(new TSoftObject <UObject>(Tests.ActorClass)), unrealClass, "Val20");
            Tests.Assert(obj.Val20.Contains(TSoftObject <UObject> .Null), unrealClass, "Val20");

            obj.Val21.Add("test1");
            obj.Val21.Add("test2");
            Tests.Assert(obj.Val21.Contains("test1"), unrealClass, "Val21");
            Tests.Assert(obj.Val21.Contains("test2"), unrealClass, "Val21");

            obj.Val22.Add(new FName("test3"));
            obj.Val22.Add(new FName("test4"));
            Tests.Assert(obj.Val22.Contains(new FName("test3")), unrealClass, "Val22");
            Tests.Assert(obj.Val22.Contains(new FName("test4")), unrealClass, "Val22");
        }