示例#1
0
文件: Form1.cs 项目: ilyakom/Sudoku
        private async void LoadSudokuFromFile_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            _model.CurrentSudoku = await SudokuAdapter.ReadFromFileAsync(LoadSudokuFromFile.FileName);

            UpdateLabelsUi();

            _model.IsSolveAvailable = true;
        }
示例#2
0
        public async Task SolveTest(string path, int solutionsCount)
        {
            var absPath = Path.Combine(TestContext.CurrentContext.TestDirectory, path);

            var sudoku = await SudokuAdapter.ReadFromFileAsync(absPath);

            var solver = new SimpleSolver();

            var actualSolutionsCount = solver.CountSolutions(sudoku);

            Assert.AreEqual(solutionsCount, actualSolutionsCount);
        }
示例#3
0
        public async Task TestTopNSolutions(string path, int solutionsLimit, Enums.TopType type, int expectedDifficulty)
        {
            var absPath = Path.Combine(TestContext.CurrentContext.TestDirectory, path);

            var sudoku = await SudokuAdapter.ReadFromFileAsync(absPath);

            var solver = new SimpleSolver();

            var solutions = solver.GetTopNSolutions(sudoku, solutionsLimit, type);

            Assert.AreEqual(solutionsLimit, solutions.Count);
            Assert.AreEqual(expectedDifficulty, solutions.First().DifficultyPoints);
        }