コード例 #1
0
ファイル: MiscBugFixTests.cs プロジェクト: xyuan/Dryad
        public static bool Bug13970_MismatchedDataTypes(DryadLinqContext context)
        {
            string testName = "Bug13970_MismatchedDataTypes";

            TestLog.TestStart(testName);

            bool passed = true;

            try
            {
                // local
                {
                    context.LocalDebug = true;
                    IQueryable <int> pt1    = DataGenerator.GetGroupByReduceDataSet(context);
                    double?          output = pt1.AverageAsQuery().Single();
                    passed &= false;
                }
            }
            catch (Exception)
            {
                passed &= true; // expected
            }

            TestLog.LogResult(new TestResult(testName, context, passed));
            return(passed);
        }
コード例 #2
0
ファイル: MiscBugFixTests.cs プロジェクト: xyuan/Dryad
        public static bool Bug13736_IndexedTakeWhile(DryadLinqContext context)
        {
            string testName = "Bug13736_IndexedTakeWhile";

            TestLog.TestStart(testName);

            bool passed = true;

            // dataset #1
            try
            {
                IEnumerable <int>[] result = new IEnumerable <int> [2];
                // cluster
                {
                    context.LocalDebug = false;
                    IQueryable <int> pt1 = DataGenerator.GetSimpleFileSets(context);
                    var pt2 = pt1.TakeWhile((x, i) => i < 6).ToArray();
                    result[0] = pt1.AsEnumerable().TakeWhile((x, i) => i < 6).ToArray();
                }
                // local
                {
                    context.LocalDebug = true;
                    IQueryable <int> pt1 = DataGenerator.GetSimpleFileSets(context);
                    var pt2 = pt1.TakeWhile((x, i) => i < 6).ToArray();
                    result[1] = pt1.AsEnumerable().TakeWhile((x, i) => i < 6).ToArray();
                }

                // compare result
                try
                {
                    Validate.Check(result);
                }
                catch (Exception ex)
                {
                    TestLog.Message("Error: " + ex.Message);
                    passed &= false;
                }
            }
            catch (Exception Ex)
            {
                TestLog.Message("Error: " + Ex.Message);
                passed &= false;
            }

            // dataset #2
            try
            {
                IEnumerable <int>[] result = new IEnumerable <int> [2];
                // cluster
                {
                    context.LocalDebug = false;
                    IQueryable <int> pt1 = DataGenerator.GetSimpleFileSets(context);
                    var pt2 = pt1.TakeWhile((x, i) => i < 125).ToArray();
                    result[0] = pt1.AsEnumerable().TakeWhile((x, i) => i < 125).ToArray();
                }
                // local
                {
                    context.LocalDebug = true;
                    IQueryable <int> pt1 = DataGenerator.GetGroupByReduceDataSet(context);
                    var pt2 = pt1.TakeWhile((x, i) => i < 125).ToArray();
                    result[0] = pt1.AsEnumerable().TakeWhile((x, i) => i < 125).ToArray();
                }

                // compare result
                try
                {
                    Validate.Check(result);
                }
                catch (Exception)
                {
                    passed &= false;
                }
            }
            catch (Exception)
            {
                passed &= false;
            }

            TestLog.LogResult(new TestResult(testName, context, passed));
            return(passed);
        }