Esempio n. 1
0
        private async void LoadSudokuFromFile_FileOk(object sender, System.ComponentModel.CancelEventArgs e)
        {
            _model.CurrentSudoku = await SudokuAdapter.ReadFromFileAsync(LoadSudokuFromFile.FileName);

            UpdateLabelsUi();

            _model.IsSolveAvailable = true;
        }
Esempio n. 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);
        }
Esempio n. 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);
        }