Inheritance: IDescriptionOfWhatIAm
        private static void TestArgumentNullCheckSpeed(int numberOfCalls)
        {
            var test1 = new Test1();
            var test2 = new Test2();
            var normalNullParameterCheckingTesting = new NormalNullParameterCheckingTesting();
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            for (var i = 0; i < numberOfCalls; i++)
            {
                normalNullParameterCheckingTesting.TestWith1(test1);
            }

            Console.WriteLine("Normal null checking speed with 1 Test parameter: " + stopWatch.ElapsedMilliseconds);

            stopWatch.Restart();

            for (var i = 0; i < numberOfCalls; i++)
            {
                normalNullParameterCheckingTesting.TestWith2(test1, test2);
            }

            Console.WriteLine("Normal null checking speed with 2 Test parameter: " + stopWatch.ElapsedMilliseconds);
        }
Example #2
0
        static void Main(string[] args)
        {
            //System.Globalization.CultureInfo.

            Test1 t1 = new Test1();
            Test2 t2 = new Test2();

            t1.a = new List<List<float>>();
            t1.a.Add(new List<float>());
            t1.a.Add(new List<float>());

            t1.a[0].Add(1);
            t1.a[1].Add(2);

            t2.a = t1.a;

            t1.a.Clear();
            t1.a.Add(new List<float>());
            t1.a.Add(new List<float>());
            t1.a[0].Add(11);
            t1.a[1].Add(22);
            //t1.a.Add(2);

            foreach (var t in new Sample())
                Console.WriteLine(t);
            //Console.ReadKey();

            pmClasses.Collection cc = new pmClasses.Collection(5);

            cc.File.Load_TextFile("E:\\#Shared#\\43-219_pasha.exp(002)_s_pr_SF(T).txt"     , null);
            cc.File.Save_TextFile("E:\\#Shared#\\43-219_pasha.exp(002)_s_pr_SF(T)_text.txt", null);
        }
Example #3
0
 public void PublicFieldGetSuccess()
 {
     var instance = new Test1();
       var expected = "public";
       var actual = Csla.Data.DataMapper.GetFieldValue(instance, "_f2");
       Assert.AreEqual(expected, actual);
 }
Example #4
0
    public static void Main()
    {
        object test1 = new Test1();
        object test2 = new Test2();

        // Test valid casts
        System.Console.WriteLine((Test1)test1 != null);
        System.Console.WriteLine((Test1)test2 != null);
        System.Console.WriteLine((Test2)test2 != null);
        System.Console.WriteLine((ITest)test2 != null);

        try
        {
            System.Console.WriteLine((Test2)test1 != null);
        }
        catch (System.InvalidCastException e)
        {
            System.Console.WriteLine("InvalidCast");
        }
        
        try
        {
            System.Console.WriteLine((ITest)test1 != null);
        }
        catch (System.InvalidCastException e)
        {
            System.Console.WriteLine("InvalidCast");
        }
    }
    public static void Main()
    {
        ITest test1 = new Test1();

        System.Console.WriteLine(test1.A01());
        System.Console.WriteLine(test1.A02());
        System.Console.WriteLine(test1.A03());
        System.Console.WriteLine(test1.A04());
        System.Console.WriteLine(test1.A05());
        System.Console.WriteLine(test1.A06());
        System.Console.WriteLine(test1.A07());
        System.Console.WriteLine(test1.A08());
        System.Console.WriteLine(test1.A09());
        System.Console.WriteLine(test1.A10());
        System.Console.WriteLine(test1.A11());
        System.Console.WriteLine(test1.A12());
        System.Console.WriteLine(test1.A13());
        System.Console.WriteLine(test1.A14());
        System.Console.WriteLine(test1.A15());
        System.Console.WriteLine(test1.A16());
        System.Console.WriteLine(test1.A17());
        System.Console.WriteLine(test1.A18());
        System.Console.WriteLine(test1.A19());
        System.Console.WriteLine(test1.A20());
    }
    public static void Main()
    {
        Test1 test1 = new Test1();
        Test1 test2 = new Test2();

        System.Console.WriteLine(test1.A());
        System.Console.WriteLine(test2.A());
    }
        public override void Setup()
        {
            base.Setup();

            _test1 = new Test1();
            Container.Bind<Test0>().AsSingle().When(r => r.ObjectInstance == _test1);
            Container.Bind<Test1>().FromInstance(_test1);
        }
Example #8
0
 public void PrivateFieldSetFail()
 {
     var instance = new Test1();
       var expected = "success";
       Csla.Data.DataMapper.SetFieldValue(instance, "_f1", expected);
       var actual = Csla.Data.DataMapper.GetFieldValue(instance, "_f1");
       Assert.AreEqual(expected, actual);
 }
    public static void Main()
    {
        SimpleDelegate action1 = new Test1().Method;
        action1("Test1");

        // TODO: Delegate to static members are not supported yet
        SimpleDelegate action2 = Method;
        action2("Test2");
    }
        public void TestConstructByFactory()
        {
            Container.Bind<Test2>().ToSingle();

            var val = new Test1();
            var test1 = Container.Instantiate<Test2>(val);

            Assert.That(test1.val == val);
        }
Example #11
0
        public void PublicFieldSetSuccess()
        {
            var instance = new Test1();
              var expected = "one";
              Csla.Data.DataMapper.SetFieldValue(instance, "_f2", expected);

              var actual = instance._f2;
              Assert.AreEqual(expected, actual);
        }
Example #12
0
        public void TestFieldOptional2()
        {
            Container.Bind<Test3>().ToSingle();

            var test1 = new Test1();
            Container.Bind<Test1>().ToInstance(test1);

            Assert.That(Container.ValidateResolve<Test3>().IsEmpty());
            Assert.IsEqual(Container.Resolve<Test3>().val1, test1);
        }
Example #13
0
        public void TestFieldOptional2()
        {
            Container.Bind<Test3>().AsSingle().NonLazy();

            var test1 = new Test1();
            Container.Bind<Test1>().FromInstance(test1).NonLazy();

            Container.Validate();

            Assert.IsEqual(Container.Resolve<Test3>().val1, test1);
        }
    public static void Main()
    {
        ITest test1 = new Test1();
        ITest test2 = new Test2();
        ITest test3 = new Test3();
        ITest test4 = new Test4();

        System.Console.WriteLine(test1.A());
        System.Console.WriteLine(test2.A());
        System.Console.WriteLine(test3.A());
        System.Console.WriteLine(test4.A());
    }
    public static void Main()
    {
        //Force static initialization order
        var test1 = new Test1();
        var test2 = new Test2();
        Test1.Method1();

          //C# and D have different order of static initialization ... D initializes all statics at once, C# does on demand (Mono)
       // Test1.Method1();
        //var test2 = new Test2();

    }
    public static void Main()
    {
        var test1 = new Test1();
        SimpleDelegate action1 = test1.Method;
        action1("Test1");

        action1 += Method;
        action1("Test2");

        action1 -= test1.Method;
        action1("Test3");
    }
Example #17
0
        public void TestPublicPrivate()
        {
            var test1 = new Test1();

            Container.Bind<Test2>().ToSingle();
            Container.Bind<Test1>().ToInstance(test1);

            Assert.That(Container.ValidateResolve<Test2>().IsEmpty());
            var test2 = Container.Resolve<Test2>();

            Assert.IsEqual(test2.val2, test1);
            Assert.IsEqual(test2.GetVal4(), test1);
        }
Example #18
0
        public void TestPublicPrivate()
        {
            var test1 = new Test1();

            Container.Bind<Test2>().AsSingle().NonLazy();
            Container.Bind<Test1>().FromInstance(test1).NonLazy();

            Container.Validate();

            var test2 = Container.Resolve<Test2>();

            Assert.IsEqual(test2.val2, test1);
            Assert.IsEqual(test2.GetVal4(), test1);
        }
Example #19
0
        public void InjectionMemberTests_BuildUp_WithoutService()
        {
            using (var container = new StashboxContainer())
            {
                container.RegisterType<ITest, Test>();
                var test1 = new Test1();
                container.BuildUp(test1);
                var inst = container.Resolve<Test1>();

                Assert.IsNotNull(inst);
                Assert.IsNotNull(inst.Test);
                Assert.IsInstanceOfType(inst, typeof(Test1));
                Assert.IsInstanceOfType(inst.Test, typeof(Test));
            }
        }
Example #20
0
        static void Main()
        {

            Test1 a = new Test1();
            Test2 a1 = new Test2();
            Test3 a2 = new Test3();
            Mutex wait = new Mutex(false);
            MyThreadPool pool = new MyThreadPool(5, wait);
            for (int I = 0; I < 20; I++) pool.PutInQueue(new Test1());
               // pool.PutInQueue(a);
            //pool.PutInQueue(a1);
            //pool.PutInQueue(a2);
            Thread.Sleep(100);
            Console.ReadKey();
            pool.EndMyThreadPool();
            Console.ReadKey();
        }
Example #21
0
    public static void Main()
    {
        object test1 = new Test1();
        object test2 = new Test2();

        System.Console.WriteLine(test1 is Test1 ? "True" : "False");
        System.Console.WriteLine(test1 is Test2);
        System.Console.WriteLine(test1 is ITest);
        System.Console.WriteLine(test2 is Test1);
        System.Console.WriteLine(test2 is Test2);
        System.Console.WriteLine(test2 is ITest);

        System.Console.WriteLine(test1 as Test1 != null ? "True" : "False");
        System.Console.WriteLine(test1 as Test2 != null);
        System.Console.WriteLine(test1 as ITest != null);
        System.Console.WriteLine(test2 as Test1 != null);
        System.Console.WriteLine(test2 as Test2 != null);
        System.Console.WriteLine(test2 as ITest != null);
    }
        public void InjectionMemberTests_BuildUp()
        {
            using (var container = new StashboxContainer())
            {
                container.RegisterType<ITest, Test>();

                var test1 = new Test1();
                container.BuildUp<ITest1>(test1);

                var inst = container.Resolve<ITest1>();

                Assert.IsNotNull(inst);
                Assert.IsNotNull(inst.Test);
                Assert.IsInstanceOfType(inst, typeof(Test1));
                Assert.IsInstanceOfType(inst.Test, typeof(Test));

                Assert.IsNotNull(((Test1)inst).TestFieldProperty);
                Assert.IsInstanceOfType(((Test1)inst).TestFieldProperty, typeof(Test));
            }
        }
Example #23
0
        public void TestOrder()
        {
            var test1 = new Test1();
            var afterTest1 = new AfterTest1();
            var beforeTest1 = new BeforeTest1();
            var afterBeforeTest1 = new AfterBeforeTest1();
            var unspecified = new Unspecified();

            var list = new List<object>() {afterBeforeTest1, test1, beforeTest1, afterTest1, unspecified};
            var sorted = ExecuteOrderSorter.Sort(list);

            sorted.Count.ShouldBe(list.Count);

            foreach (var o in sorted)
            {
                Console.WriteLine(o);
            }

            AssertOrder(beforeTest1, test1, sorted);
            AssertOrder(test1, afterTest1, sorted);
            AssertOrder(beforeTest1, afterBeforeTest1, sorted);
        }
Example #24
0
 public static void CreateCollector <T>(this Test1 <T> arg1, Test2 <T>[] arg2)
 {
 }
        public void Get_Class_Parsed()
        {
            var test = new Test1
            {
                Property1 = 1M,
                Property2 = "val",
                Property3 = _now
            };

            var outDic = _digger.Get(test);
            Assert.That(outDic.Count, Is.EqualTo(3));
            Assert.That(outDic["Property1"].PropertyNameSource, Is.EqualTo(PropertyNameSource.Default));
            Assert.That(outDic["Property1"].Value, Is.EqualTo(1M));
            Assert.That(outDic["Property2"].PropertyNameSource, Is.EqualTo(PropertyNameSource.Default));
            Assert.That(outDic["Property2"].Value, Is.EqualTo("val"));
            Assert.That(outDic["Property3"].PropertyNameSource, Is.EqualTo(PropertyNameSource.Default));
            Assert.That(outDic["Property3"].Value, Is.EqualTo(_now));
        }
Example #26
0
 public Test4(Test1 val1)
 {
 }
 public Test3(Test1 val)
 {
     this.val = val;
 }
Example #28
0
        public static void DoTestWithSerialization()
        {
            Console.WriteLine("----- JsonSerializerTest.DoTestWithSerialization -----");

            JsonSerializer serializer = new JsonSerializer();

            Test1 t1 = new Test1()
            {
                A = 1,
                B = 2,
                C = 3
            };

            Test2 t2 = new Test2()
            {
                A = 2,
                B = 4,
                C = 6
            };

            Test3 t3 = new Test3()
            {
                A = 3,
                B = 6,
                C = 9
            };


            MemoryStream stream1 = new MemoryStream(20480);
            MemoryStream stream2 = new MemoryStream(20480);
            MemoryStream stream3 = new MemoryStream(20480);

            using (StreamWriter sw = new StreamWriter(stream1))
            {
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, t1);
                }
            }
            using (StreamWriter sw = new StreamWriter(stream2))
            {
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, t2);
                }
            }
            using (StreamWriter sw = new StreamWriter(stream3))
            {
                using (JsonWriter writer = new JsonTextWriter(sw))
                {
                    serializer.Serialize(writer, t3);
                }
            }


            string jsonString1 = Encoding.UTF8.GetString(stream1.ToArray());

            Console.WriteLine("Test1 对象转换为 Json 字符串:\n{0}", jsonString1);

            string jsonString2 = Encoding.UTF8.GetString(stream2.ToArray());

            Console.WriteLine("Test2 对象转换为 Json 字符串:\n{0}", jsonString2);

            string jsonString3 = Encoding.UTF8.GetString(stream3.ToArray());

            Console.WriteLine("Test3 对象转换为 Json 字符串:\n{0}", jsonString3);
        }
Example #29
0
        static void Main(string[] args)
        {
            //全て.Net Framework上で実行したい場合はこちらをコメントアウト
            Weaver.Initialize(ComputeDeviceTypes.Gpu);
            //Weaver.Initialize(ComputeDeviceTypes.Cpu, 1); //複数デバイスがある場合は添字が必要

            //MLPによるXORの学習
            Test1.Run();

            //MLPによるXORの学習【回帰版】
            //Test2.Run();

            //MLPによるSin関数の学習
            //Test3.Run();

            //MLPによるMNIST(手書き文字)の学習
            //Test4.Run();

            //エクセルCNNの再現
            //Test5.Run();

            //5層CNNによるMNISTの学習
            //Test6.Run();

            //BatchNormを使った15層MLPによるMNISTの学習
            //Test7.Run();

            //LSTMによるSin関数の学習
            //Test8.Run();

            //SimpleなRNNによるRNNLM
            //Test9.Run();

            //LSTMによるRNNLM
            //Test10.Run();

            //Decoupled Neural Interfaces using Synthetic GradientsによるMNISTの学習
            //Test11.Run();

            //Test11のDNIをcDNIとした
            //Test12.Run();

            //Deconvolution2Dのテスト(Winform)
            //new Test13WinForm().ShowDialog();

            //Test6を連結して実行
            //Test14.Run();

            //CaffeモデルのVGG16を読み込んで画像分類をさせるテスト
            //Test15.Run();

            //ChainerモデルのTest5と同じ内容を読み込んで実行
            //Test16.Run();

            //CaffeモデルのRESNETを読み込んで画像分類をさせるテスト
            //Test17.Run(Test17.ResnetModel.ResNet50);  //任意のResnetモデルを選択してください

            //CIFAR-10を5層CNNを使って学習する
            //Test18.Run(isCifar100:false, isFineLabel:false);

            //CaffeモデルのAlexNetを読み込んで画像分類をさせるテスト
            //Test19.Run();

            //Linearの分割実行
            //TestX.Run();

            //ベンチマーク
            SingleBenchmark.Run();

            Console.WriteLine("Test Done...");
            Console.Read();
        }
Example #30
0
    public static void Main()
    {
        ITest <string> test1 = new Test1();

        System.Console.WriteLine(test1.A());
    }
        private static void TestParameterValidatorSpeed(int numberOfCalls)
        {
            var test1 = new Test1();
            var test2 = new Test2();
            var parameterValidatorTesting = new ParameterValidatorTesting();
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            for (var i = 0; i < numberOfCalls; i++)
            {
                parameterValidatorTesting.TestWith1(test1);
            }

            Console.WriteLine("Parameter Validator speed with 1 Test parameter: " + stopWatch.ElapsedMilliseconds);

            stopWatch.Restart();

            for (var i = 0; i < numberOfCalls; i++)
            {
                parameterValidatorTesting.TestWith2(test1, test2);
            }

            Console.WriteLine("Parameter Validator speed with 2 Test parameter: " + stopWatch.ElapsedMilliseconds);

            stopWatch.Restart();

            for (var i = 0; i < numberOfCalls; i++)
            {
                parameterValidatorTesting.TestWith1AndValue(test1);
            }

            Console.WriteLine("Parameter Validator speed with 2 Test parameter and specifying values (No expression compilation): " + stopWatch.ElapsedMilliseconds);

            stopWatch.Restart();

            for (var i = 0; i < numberOfCalls; i++)
            {
                parameterValidatorTesting.TestWith2AndValue(test1, test2);
            }

            Console.WriteLine("Parameter Validator speed with 2 Test parameter and specifying values (No expression compilation): " + stopWatch.ElapsedMilliseconds);
        }
 public Test2(Test1 test1, Test1 test2, Test1 test3, Test1 test4)
 {
 }
Example #33
0
 public Test1 test(Test1 test)
 {
     test.Id   = 5;
     test.Name = "ali";
     return(test);
 }
Example #34
0
        public void Add(Test1 test)
        {
            var vv = new Repository <Test1>(_context);

            vv.Add(test);
        }
Example #35
0
        public async Task Click2()
        {
            await Task.Delay(3000);

            await Test1.SetAsync("Thehehest");
        }
Example #36
0
    public static void Main()
    {
        var t = new Test1();

        t.Play();
    }
 public void TestWith2(Test1 test1, Test2 test2)
 {
     if (test1 == null) throw new ArgumentNullException("test1");
     if (test2 == null) throw new ArgumentNullException("test2");
 }
Example #38
0
        private string ClassAndStructTest(out string str2)
        {
            //DateTimeList为自定义的一个类型,见引用部分,其类型为List<T>
            DateTimeList dtl = new DateTimeList();

            //逆变协变的使用
            Func <Object, ArgumentException> fn1 = null;
            Func <string, Exception>         fn2 = fn1;

            //可空值类型
            //若不为可空值类型,则其值不可为null
            Nullable <int> nullX = 3;
            int?           nullY = 4;

            nullX = null;
            //当左边不为null,则等于左边,否则等于右边
            int?nullZ = nullX ?? nullY;

            nullY = nullX;
            nullZ = nullX ?? nullY ?? 5;

            try
            {
                Member m = new Member()
                {
                    Nage = "123", Age = 5 - 3
                };
            }
            catch (System.ArgumentOutOfRangeException ex)
            {
                MessageBox.Show(ex.Message);
            }
            //匿名类型
            var       o1  = new { Name = "123", Age = -3, Sex = "F" };
            someClass sc  = new someClass();
            someClass sc2 = new someClass();

            someStruct ss  = new someStruct();
            someStruct ss2 = new someStruct();

            sc.x = 3;
            sc2  = sc;
            sc.x = 5;

            ss.x = 4;
            ss2  = ss;
            ss.x = 6;

            object     o   = ss.x;
            someStruct ss3 = new someStruct();
            someClass  sc3 = new someClass();

            ss3.x = (int)o;
            sc3.x = (int)o;
            ss.x  = 7;
            o     = 9;

            int j = 3;
            int k = 9;

            if (j == k)
            {
            }
            MethodsClass.SetDouble(ref j);
            Swap(ref k, ref j);
            Test1 <string>  t1   = new Test1 <string>();
            ITest1 <string> t2   = t1;
            string          t1r  = t1.TestIMethod();
            string          t2r  = t2.TestIMethod();
            string          str1 = @"/// <summary>
/// 引用类型,在内存中,传递指针
/// </summary>
class someClass
{
    public int x;
}
/// <summary>
/// 在线程栈中,复制值
/// </summary>
struct someStruct
{
    public int x;
}
someClass sc = new someClass();
someClass sc2 = new someClass();

someStruct ss = new someStruct();
someStruct ss2 = new someStruct();
sc.x = 3;
sc2 = sc;
sc.x = 5;

ss.x = 4;
ss2 = ss;
ss.x = 6;

object o = ss.x;
someStruct ss3 = new someStruct();
someClass sc3 = new someClass();
ss3.x = (int)o;
sc3.x = (int)o;
ss.x = 7
o = 9;
int j = 3;
int k = 9;
SetDouble(ref j);
Swap(ref k, ref j);
=====================================================================
";

            str2  = "sc=" + sc.x + "\n" + "sc2=" + sc2.x + "\n" + "ss=" + ss.x + "\n" + "ss2=" + ss2.x + "\n";
            str2 += "ss3=" + ss3.x + "\nsc3=" + sc3.x + "\no=" + o + "\nj.Triple()=" + j.Triple() + "\n";
            str2 += DisplayTypes(3, "ss", o, j, k, null);
            string a = null;
            //若a为空,则将x赋值给b
            string b = a ?? "x";

            return(str1);
        }
 public void TestWith2AndValue(Test1 test1, Test2 test2)
 {
     ParameterValidator.ParameterValidator.EnsureParametersAreValid(new NullValidatorWithValue<Test1>(() => test1, test1), new NullValidatorWithValue<Test2>(() => test2, test2));
 }
Example #40
0
    public static int Main()
    {
        IsTrue(Test1.StartsWith1(""));
        IsTrue(Test1.StartsWith2(""));
        IsTrue(Test1.StartsWith3(""));
        IsTrue(Test1.StartsWith4(""));
        IsTrue(Test1.StartsWith5(""));

        IsTrue(!Test1.StartsWith1("swar"));
        IsTrue(!Test1.StartsWith2("swar"));
        IsTrue(!Test1.StartsWith3("swar"));
        IsTrue(!Test1.StartsWith4("swar"));
        IsTrue(!Test1.StartsWith5("swar"));

        IsTrue(!Test1.StartsWith1("simd"));
        IsTrue(!Test1.StartsWith2("simd"));
        IsTrue(!Test1.StartsWith3("simd"));
        IsTrue(!Test1.StartsWith4("simd"));
        IsTrue(!Test1.StartsWith5("simd"));

        IsTrue(!Test1.StartsWith1("swar\0"));
        IsTrue(!Test1.StartsWith2("swar\0"));
        IsTrue(!Test1.StartsWith3("swar\0"));
        IsTrue(!Test1.StartsWith4("swar\0"));
        IsTrue(!Test1.StartsWith5("swar\0"));

        IsTrue(!Test1.StartsWith1(" swar"));
        IsTrue(!Test1.StartsWith2(" swar"));
        IsTrue(!Test1.StartsWith3(" swar"));
        IsTrue(!Test1.StartsWith4(" swar"));
        IsTrue(!Test1.StartsWith5(" swar"));

        IsTrue(!Test1.StartsWith1("swarswar"));
        IsTrue(!Test1.StartsWith2("swarswar"));
        IsTrue(!Test1.StartsWith3("swarswar"));
        IsTrue(!Test1.StartsWith4("swarswar"));
        IsTrue(!Test1.StartsWith5("swarswar"));

        IsTrue(!Test1.StartsWith1("simd"));
        IsTrue(!Test1.StartsWith2("simd"));
        IsTrue(!Test1.StartsWith3("simd"));
        IsTrue(!Test1.StartsWith4("simd"));
        IsTrue(!Test1.StartsWith5("simd"));

        IsTrue(!Test1.StartsWith1("simx"));
        IsTrue(!Test1.StartsWith2("simx"));
        IsTrue(!Test1.StartsWith3("simx"));
        IsTrue(!Test1.StartsWith4("simx"));
        IsTrue(!Test1.StartsWith5("simx"));

        IsTrue(!Test1.StartsWith1("simdsimdsimd"));
        IsTrue(!Test1.StartsWith2("simdsimdsimd"));
        IsTrue(!Test1.StartsWith3("simdsimdsimd"));
        IsTrue(!Test1.StartsWith4("simdsimdsimd"));
        IsTrue(!Test1.StartsWith5("simdsimdsimd"));

        IsTrue(!Test1.StartsWith1("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test1.StartsWith2("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test1.StartsWith3("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test1.StartsWith4("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test1.StartsWith5("simdsimdsimdsimdsimdsimd"));


        IsTrue(Test2.StartsWith1(""));
        IsTrue(Test2.StartsWith2(""));
        IsTrue(Test2.StartsWith3(""));
        IsTrue(Test2.StartsWith4(""));
        IsTrue(Test2.StartsWith5(""));

        IsTrue(Test2.StartsWith1("swar"));
        IsTrue(Test2.StartsWith2("swar"));
        IsTrue(Test2.StartsWith3("swar"));
        IsTrue(Test2.StartsWith4("swar"));
        IsTrue(Test2.StartsWith5("swar"));

        IsTrue(Test2.StartsWith1("swa"));
        IsTrue(Test2.StartsWith2("swa"));
        IsTrue(Test2.StartsWith3("swa"));
        IsTrue(Test2.StartsWith4("swa"));
        IsTrue(Test2.StartsWith5("swa"));

        IsTrue(Test2.StartsWith1("s"));
        IsTrue(Test2.StartsWith2("s"));
        IsTrue(Test2.StartsWith3("s"));
        IsTrue(Test2.StartsWith4("s"));
        IsTrue(Test2.StartsWith5("s"));

        IsTrue(!Test2.StartsWith1("s\0"));
        IsTrue(!Test2.StartsWith2("s\0"));
        IsTrue(!Test2.StartsWith3("s\0"));
        IsTrue(!Test2.StartsWith4("s\0"));
        IsTrue(!Test2.StartsWith5("s\0"));

        IsTrue(!Test2.StartsWith1("simd"));
        IsTrue(!Test2.StartsWith2("simd"));
        IsTrue(!Test2.StartsWith3("simd"));
        IsTrue(!Test2.StartsWith4("simd"));
        IsTrue(!Test2.StartsWith5("simd"));

        IsTrue(!Test2.StartsWith1("swar\0"));
        IsTrue(!Test2.StartsWith2("swar\0"));
        IsTrue(!Test2.StartsWith3("swar\0"));
        IsTrue(!Test2.StartsWith4("swar\0"));
        IsTrue(!Test2.StartsWith5("swar\0"));

        IsTrue(!Test2.StartsWith1(" swar"));
        IsTrue(!Test2.StartsWith2(" swar"));
        IsTrue(!Test2.StartsWith3(" swar"));
        IsTrue(!Test2.StartsWith4(" swar"));
        IsTrue(!Test2.StartsWith5(" swar"));

        IsTrue(!Test2.StartsWith1("swarswar"));
        IsTrue(!Test2.StartsWith2("swarswar"));
        IsTrue(!Test2.StartsWith3("swarswar"));
        IsTrue(!Test2.StartsWith4("swarswar"));
        IsTrue(!Test2.StartsWith5("swarswar"));

        IsTrue(!Test2.StartsWith1("simd"));
        IsTrue(!Test2.StartsWith2("simd"));
        IsTrue(!Test2.StartsWith3("simd"));
        IsTrue(!Test2.StartsWith4("simd"));
        IsTrue(!Test2.StartsWith5("simd"));

        IsTrue(!Test2.StartsWith1("simx"));
        IsTrue(!Test2.StartsWith2("simx"));
        IsTrue(!Test2.StartsWith3("simx"));
        IsTrue(!Test2.StartsWith4("simx"));
        IsTrue(!Test2.StartsWith5("simx"));

        IsTrue(!Test2.StartsWith1("simdsimdsimd"));
        IsTrue(!Test2.StartsWith2("simdsimdsimd"));
        IsTrue(!Test2.StartsWith3("simdsimdsimd"));
        IsTrue(!Test2.StartsWith4("simdsimdsimd"));
        IsTrue(!Test2.StartsWith5("simdsimdsimd"));

        IsTrue(!Test2.StartsWith1("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test2.StartsWith2("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test2.StartsWith3("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test2.StartsWith4("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test2.StartsWith5("simdsimdsimdsimdsimdsimd"));


        IsTrue(Test3.StartsWith1(""));
        IsTrue(Test3.StartsWith2(""));
        IsTrue(Test3.StartsWith3(""));
        IsTrue(Test3.StartsWith4(""));
        IsTrue(Test3.StartsWith5(""));

        IsTrue(!Test3.StartsWith1("swar"));
        IsTrue(!Test3.StartsWith2("swar"));
        IsTrue(!Test3.StartsWith3("swar"));
        IsTrue(!Test3.StartsWith4("swar"));
        IsTrue(!Test3.StartsWith5("swar"));

        IsTrue(Test3.StartsWith1("simd"));
        IsTrue(Test3.StartsWith2("simd"));
        IsTrue(Test3.StartsWith3("simd"));
        IsTrue(Test3.StartsWith4("simd"));
        IsTrue(Test3.StartsWith5("simd"));

        IsTrue(!Test3.StartsWith1("swar\0"));
        IsTrue(!Test3.StartsWith2("swar\0"));
        IsTrue(!Test3.StartsWith3("swar\0"));
        IsTrue(!Test3.StartsWith4("swar\0"));
        IsTrue(!Test3.StartsWith5("swar\0"));

        IsTrue(!Test3.StartsWith1(" swar"));
        IsTrue(!Test3.StartsWith2(" swar"));
        IsTrue(!Test3.StartsWith3(" swar"));
        IsTrue(!Test3.StartsWith4(" swar"));
        IsTrue(!Test3.StartsWith5(" swar"));

        IsTrue(!Test3.StartsWith1("swarswar"));
        IsTrue(!Test3.StartsWith2("swarswar"));
        IsTrue(!Test3.StartsWith3("swarswar"));
        IsTrue(!Test3.StartsWith4("swarswar"));
        IsTrue(!Test3.StartsWith5("swarswar"));

        IsTrue(Test3.StartsWith1("simd"));
        IsTrue(Test3.StartsWith2("simd"));
        IsTrue(Test3.StartsWith3("simd"));
        IsTrue(Test3.StartsWith4("simd"));
        IsTrue(Test3.StartsWith5("simd"));

        IsTrue(!Test3.StartsWith1("simx"));
        IsTrue(!Test3.StartsWith2("simx"));
        IsTrue(!Test3.StartsWith3("simx"));
        IsTrue(!Test3.StartsWith4("simx"));
        IsTrue(!Test3.StartsWith5("simx"));

        IsTrue(Test3.StartsWith1("simdsimdsimd"));
        IsTrue(Test3.StartsWith2("simdsimdsimd"));
        IsTrue(Test3.StartsWith3("simdsimdsimd"));
        IsTrue(Test3.StartsWith4("simdsimdsimd"));
        IsTrue(Test3.StartsWith5("simdsimdsimd"));

        IsTrue(!Test3.StartsWith1("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test3.StartsWith2("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test3.StartsWith3("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test3.StartsWith4("simdsimdsimdsimdsimdsimd"));
        IsTrue(!Test3.StartsWith5("simdsimdsimdsimdsimdsimd"));

        return(retCode);
    }
Example #41
0
 public override int GetHashCode()
 {
     return(Test1.GetHashCode() + Test2.GetHashCode());
 }
Example #42
0
 public static int Main()
 {
     Test1.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test1 OK");
     }
     Test2.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test2 OK");
     }
     Test3.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test3 OK");
     }
     Test4.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test4 OK");
     }
     Test5.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test5 OK");
     }
     Test6.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test6 OK");
     }
     Test7.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test7 OK");
     }
     Test8.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test8 OK");
     }
     Test9.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test9 OK");
     }
     Test10.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test10 OK");
     }
     Test11.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test11 OK");
     }
     Test12.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test12 OK");
     }
     Test13.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test13 OK");
     }
     Test14.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test14 OK");
     }
     Test15.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test15 OK");
     }
     Test16.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test16 OK");
     }
     Test17.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test17 OK");
     }
     Test18.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test18 OK");
     }
     Test19.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test19 OK");
     }
     Test20.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test20 OK");
     }
     Test21.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test21 OK");
     }
     Test22.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test22 OK");
     }
     Test23.Test();
     if (Utils.failures == 0)
     {
         Console.WriteLine("Test23 OK");
     }
     if (Utils.failures > 0)
     {
         return(101);
     }
     else
     {
         Console.WriteLine("PASS");
         return(100);
     }
 }
Example #43
0
 public Test2(Test1 test0, Test1 test1)
 {
     Test0 = test0;
     Test1 = test1;
 }
Example #44
0
 /// <summary>
 ///
 /// </summary>
 public void WriteLog()
 {
     TraceLogger.WriteInfo(string.Format("LoggerTest {0}, {1}", Test1.GetName(), Test2.GetName()));
     ErrorLogger.WriteInfo("ErrorLoggerTest");
     DebugLogger.WriteInfo("LoggerTest");
 }
Example #45
0
        private void JsctxtUserClick(object sender, EventArgs e)
        {
            var frmtest = new Test1();

            frmtest.Show();
        }
 public TestScope2(Test1 test1)
 {
     Test1 = test1;
 }
Example #47
0
 public Test5(
     [InjectOptional]
     Test1 val1)
 {
     Val1 = val1;
 }
Example #48
0
 public Test5(
     [InjectOptional]
     Test1 val1)
 {
     Val1 = val1;
 }
Example #49
0
 public Test2(Test1 t1)
 {
 }
Example #50
0
 public void Method(T param)
 {
     Test1 <T> .Action(param);
 }
Example #51
0
 public Test2(Test1 val = null)
 {
     this.val = val;
 }
Example #52
0
 public void setLC(Test1 l)
 {
     t = l;
 }
 public void TestWith1(Test1 test1)
 {
     if (test1 == null) throw new ArgumentNullException("test1");
 }
Example #54
0
    public bool runTest()
    {
        Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
        int                iCountErrors    = 0;
        int                iCountTestcases = 0;
        String             strLoc          = "Loc_000oo";
        ObjectManager      objmgr1         = null;
        ISurrogateSelector isur            = null;
        StreamingContext   sc1             = new StreamingContext(StreamingContextStates.All);
        ObjectIDGenerator  objid1          = null;
        TestFixup          tstfxp1;
        Int64              iRootID;
        Int64              iChildID;
        String             strValue;
        bool               fFirstTime;

        MemberInfo[] members = null;
        Test1        tst1;
        A            a1;
        Int32        iOurMan;
        Boolean      fChildFound;
        Test2        tst2;
        Test3        tst3;
        B            b1;

        try {
            do
            {
                tstfxp1  = new TestFixup();
                objid1   = new ObjectIDGenerator();
                iRootID  = objid1.GetId(tstfxp1, out fFirstTime);
                strValue = "Hello World";
                iChildID = objid1.GetId(strValue, out fFirstTime);
                members  = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
                objmgr1  = new ObjectManager(isur, sc1);
                objmgr1.RecordFixup(iRootID, members[0], iChildID);
                objmgr1.RegisterObject(tstfxp1, iRootID);
                objmgr1.RegisterObject(strValue, iChildID);
                iCountTestcases++;
                if (!tstfxp1.strFixupValue.Equals(strValue))
                {
                    iCountErrors++;
                    Console.WriteLine("Err_753cd! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
                }
                objmgr1.DoFixups();
                iCountTestcases++;
                if (!tstfxp1.strFixupValue.Equals(strValue))
                {
                    iCountErrors++;
                    Console.WriteLine("Err_90342ddvs! Expected value not returned, " + tstfxp1.strFixupValue + ", expected, " + strValue);
                }
                tst1        = new Test1();
                a1          = new A();
                objid1      = new ObjectIDGenerator();
                iRootID     = objid1.GetId(tst1, out fFirstTime);
                iChildID    = objid1.GetId(a1, out fFirstTime);
                members     = FormatterServices.GetSerializableMembers(typeof(Test1));
                iOurMan     = -1;
                fChildFound = false;
                for (int i = 0; i < members.Length; i++)
                {
                    if (members[i].Name.Equals("a"))
                    {
                        fChildFound = true;
                        iOurMan     = i;
                        break;
                    }
                }
                if (!fChildFound)
                {
                    throw new Exception("Loc_342ds! didn't find the member");
                }
                objmgr1 = new ObjectManager(isur, sc1);
                objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
                try{
                    iCountTestcases++;
                    objmgr1.RegisterObject(a1, iChildID);
                    objmgr1.RegisterObject(tst1, iRootID);
                    objmgr1.DoFixups();
                    Console.WriteLine("Loc_0283! exception not thrown");
                }catch (Exception ex) {
                    iCountErrors++;
                    Console.WriteLine("Err_04523cd! Unexpected exception, " + ex.ToString());
                }
                tst1        = new Test1();
                objid1      = new ObjectIDGenerator();
                iRootID     = objid1.GetId(tst1, out fFirstTime);
                a1          = new A();
                iChildID    = objid1.GetId(a1, out fFirstTime);
                members     = FormatterServices.GetSerializableMembers(typeof(Test1));
                iOurMan     = -1;
                fChildFound = false;
                for (int i = 0; i < members.Length; i++)
                {
                    if (members[i].Name.Equals("a"))
                    {
                        fChildFound = true;
                        iOurMan     = i;
                        break;
                    }
                }
                if (!fChildFound)
                {
                    throw new Exception("Loc_342ds! didn't find the member");
                }
                objmgr1 = new ObjectManager(isur, sc1);
                objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
                try{
                    iCountTestcases++;
                    objmgr1.DoFixups();
                    iCountErrors++;
                    Console.WriteLine("Err_7453fd! exception not thrown");
                }catch (SerializationException) {
                }catch (Exception ex) {
                    iCountErrors++;
                    Console.WriteLine("Err_1204cd! Unexpected exception, " + ex.ToString());
                }
                tst1        = new Test1();
                objid1      = new ObjectIDGenerator();
                iRootID     = objid1.GetId(tst1, out fFirstTime);
                a1          = new A();
                iChildID    = objid1.GetId(a1, out fFirstTime);
                members     = FormatterServices.GetSerializableMembers(typeof(Test1));
                iOurMan     = -1;
                fChildFound = false;
                for (int i = 0; i < members.Length; i++)
                {
                    if (members[i].Name.Equals("a"))
                    {
                        fChildFound = true;
                        iOurMan     = i;
                        break;
                    }
                }
                if (!fChildFound)
                {
                    throw new Exception("Loc_342ds! didn't find the member");
                }
                objmgr1 = new ObjectManager(isur, sc1);
                try{
                    iCountTestcases++;
                    objmgr1.RegisterObject(a1, iChildID);
                    objmgr1.RegisterObject(tst1, iRootID);
                    objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
                    objmgr1.DoFixups();
                    Console.WriteLine("Loc_02843cd! exception not thrown");
                }catch (Exception ex) {
                    iCountErrors++;
                    Console.WriteLine("Err_0438fd! Unexpected exception, " + ex.ToString());
                }
                tst1        = new Test1();
                objid1      = new ObjectIDGenerator();
                iRootID     = objid1.GetId(tst1, out fFirstTime);
                a1          = new A();
                iChildID    = objid1.GetId(a1, out fFirstTime);
                members     = FormatterServices.GetSerializableMembers(typeof(Test1));
                iOurMan     = -1;
                fChildFound = false;
                for (int i = 0; i < members.Length; i++)
                {
                    if (members[i].Name.Equals("a"))
                    {
                        fChildFound = true;
                        iOurMan     = i;
                        break;
                    }
                }
                if (!fChildFound)
                {
                    throw new Exception("Loc_342fsd! didn't find the member");
                }
                objmgr1 = new ObjectManager(isur, sc1);
                try{
                    iCountTestcases++;
                    objmgr1.RegisterObject(a1, iChildID);
                    objmgr1.RegisterObject(tst1, iRootID);
                    objmgr1.DoFixups();
                    Console.WriteLine("Loc_94523fsd! exception not thrown");
                }catch (Exception ex) {
                    iCountErrors++;
                    Console.WriteLine("Err_0348dcs! Unexpected exception, " + ex.ToString());
                }
                tst2        = new Test2();
                tst3        = new Test3();
                b1          = new B();
                b1.StrValue = "Hello World";
                tst3.Set_B  = b1;
                objid1      = new ObjectIDGenerator();
                iRootID     = objid1.GetId(tst2, out fFirstTime);
                iChildID    = objid1.GetId(tst3, out fFirstTime);
                members     = FormatterServices.GetSerializableMembers(typeof(Test2));
                iOurMan     = -1;
                fChildFound = false;
                for (int i = 0; i < members.Length; i++)
                {
                    if (members[i].Name.Equals("tst3"))
                    {
                        fChildFound = true;
                        iOurMan     = i;
                        break;
                    }
                }
                if (!fChildFound)
                {
                    throw new Exception("Loc_024fd! didn't find the member");
                }
                objmgr1 = new ObjectManager(isur, sc1);
                objmgr1.RecordFixup(iRootID, members[iOurMan], iChildID);
                objmgr1.RegisterObject(tst2, iRootID);
                objmgr1.RegisterObject(tst3, iChildID);
                iCountTestcases++;
                Console.WriteLine("Loc_4523vfd! we hve, " + tst2.StrValue);
                if (!tst2.StrValue.Equals("Hello World"))
                {
                    iCountErrors++;
                    Console.WriteLine("Err_038qm! Expected value not returned, " + tst2.StrValue);
                }
                tstfxp1  = new TestFixup();
                objid1   = new ObjectIDGenerator();
                iRootID  = objid1.GetId(tstfxp1, out fFirstTime);
                strValue = "Hello World";
                members  = FormatterServices.GetSerializableMembers(tstfxp1.GetType());
                objmgr1  = new ObjectManager(null, sc1);
                objmgr1.RecordFixup(iRootID, members[0], iRootID);
                try{
                    iCountTestcases++;
                    objmgr1.RegisterObject(tstfxp1, iRootID);
                    iCountErrors++;
                    Console.WriteLine("Err_753cd! exception not thrown");
                }catch (ArgumentException) {
                }catch (Exception ex) {
                    iCountErrors++;
                    Console.WriteLine("Err_04523cd! Unexpected exception, " + ex.ToString());
                }
                try
                {
                    iCountTestcases++;
                    objmgr1.RecordFixup(-1, members[0], iChildID);
                    iCountErrors++;
                    Console.WriteLine("Err_034cd! exception not thrown");
                }
                catch (ArgumentOutOfRangeException) {}
                catch (Exception ex)
                {
                    iCountErrors++;
                    Console.WriteLine("Err_034cd! Unexpected exception, " + ex.ToString());
                }
                try
                {
                    iCountTestcases++;
                    objmgr1.RecordFixup(iRootID, members[0], -5);
                    iCountErrors++;
                    Console.WriteLine("Err_037csd! exception not thrown");
                }
                catch (ArgumentOutOfRangeException) {}
                catch (Exception ex)
                {
                    iCountErrors++;
                    Console.WriteLine("Err_710ca! Unexpected exception, " + ex.ToString());
                }
                try
                {
                    iCountTestcases++;
                    objmgr1.RecordFixup(iRootID, null, iChildID);
                    iCountErrors++;
                    Console.WriteLine("Err_048cs! exception not thrown");
                }
                catch (ArgumentNullException) {}
                catch (Exception ex)
                {
                    iCountErrors++;
                    Console.WriteLine("Err_079cd! Unexpected exception, " + ex.ToString());
                }
            } while (false);
        } catch (Exception exc_general) {
            ++iCountErrors;
            Console.WriteLine(s_strTFAbbrev + " : Error Err_8888yyy!  strLoc==" + strLoc + ", exc_general==\n" + exc_general.StackTrace);
        }
        if (iCountErrors == 0)
        {
            Console.WriteLine("paSs.   " + s_strTFPath + " " + s_strTFName + " ,iCountTestcases==" + iCountTestcases);
            return(true);
        }
        else
        {
            Console.WriteLine("FAiL!   " + s_strTFPath + " " + s_strTFName + " ,iCountErrors==" + iCountErrors + " , BugNums?: " + s_strActiveBugNums);
            return(false);
        }
    }
 public void TestWith1(Test1 test1)
 {
     ParameterValidator.ParameterValidator.EnsureParametersAreValid(new NullValidator<Test1>(() => test1));
 }
Example #56
0
 // Use this for initialization
 void Start()
 {
     AssetManager.Initialize();
     _t = new Test1();
 }
Example #57
0
 public static void RunTest()
 {
     Test1.Test();
 }
 public Test4(Test1 test1)
 {
     this.test1 = test1;
 }
Example #59
0
 static int Main()
 {
     return((Test1.Run() & Test2.Run() & Test3.Run()) ? 100 : -1);
 }
Example #60
0
 public void SetDeps(Test1 test1)
 {
     Test1 = test1;
 }