Example #1
0
        public void TestAllCases(
            [Values(VarType.Const, VarType.N)] VarType outerBound,
            [Values(OpType.Increase, OpType.Multiply)] OpType outerOp,
            [Values(VarType.Const, VarType.N)] VarType outerStep
            )
        {
            var varTypes = Enum.GetValues(typeof(VarType)).Cast <VarType>();
            var random   = new Random(1224);

            foreach (var innerStep in varTypes)
            {
                var outer    = new Loop(outerBound, outerOp, outerStep);
                var exercise = new SingleLoopExercise(outer, LoopType.For);
                exercise.GetComplexity()
                .Should()
                .Be(ComplexityChecker.Check(exercise), exercise.GetCode(random));
            }
        }
Example #2
0
        public static Complexity Check(SingleLoopExercise exercise)
        {
            var column = GetColumn(exercise.Loop);

            return(Answer[0, column]);
        }