コード例 #1
0
ファイル: Scopes.cs プロジェクト: elkawee/UShell
        public static void Equivalent(CH_closedScope cls, preCH_deltaScope deltaSC)
        {
            int common_count = cls.refs().Count();
            var test         = cls.refs().Zip(deltaSC.refs(), (ref_L, ref_R) => ReferenceEquals(ref_L.CH, ref_R.pre_ch.CH));

            D.Assert(test.All(_ => _));                // all true
            D.Assert(test.Count() == common_count);    // re-evals ... stress testing is never bad
        }
コード例 #2
0
ファイル: Scopes.cs プロジェクト: elkawee/UShell
        // to be able to write down expected result in a readable way
        public static void AssertEquivalent(CH_closedScope cls, string [] names, TypedCH [] CHs)
        {
            D.Assert(names.Length == CHs.Length);
            // cls.refs().NLSendRec("scope refs" , 1 , (_obj) => doing( (CH_Scope.Ref) _obj ) ); // git f****d this prototype
            var zipped_refs = names
                              .Zip(CHs, (n, ch) => new CH_Scope.Ref {
                name = n, CH = ch
            })
                              /*.NLSendRec("zpipped" , 1 , doing )*/;


            var test = cls.refs().Zip(zipped_refs,
                                      (r_left, r_right) =>
                                      (r_left.name == r_right.name) &&                  //.NLSend("name_equal")
                                      ReferenceEquals(r_left.CH, r_right.CH)            //.NLSend("ref_equal")
                                      ).NLSendRec();

            D.Assert(names.Length == test.Count());
            D.Assert(test.All(_ => _));
        }