Exemplo n.º 1
0
        public void IsValidReturnsTrueWhenAllUnknown()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            Assert.AreEqual(true, l.IsValid());
        }
Exemplo n.º 2
0
        public void IsValidReturnsFalseWhenHintIsNotPossible_Hint32()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l.Hints.AddRange(new int[] { 3, 2 });

            Assert.AreEqual(false, l.IsValid());
        }
Exemplo n.º 3
0
        public void IsValidReturnsTrueWhenHintMatchesContents_Hint0_Contents0()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l.Fill(Cell.CellState.Blank);

            Assert.AreEqual(true, l.IsValid());
        }
Exemplo n.º 4
0
        public void IsValidReturnsFalseWhenHintsExistButAllBlank()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l.Fill(Cell.CellState.Blank);
            l.Hints.AddRange(new int[] { 1 });

            Assert.AreEqual(false, l.IsValid());
        }
Exemplo n.º 5
0
        public void IsValidReturnsTrueWhenPossibleSolutionsExist()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l.Fill(0, 3, Cell.CellState.Blank);
            l[4].State = Cell.CellState.Blank;
            l.Hints.AddRange(new int[] { 1 });

            Assert.AreEqual(true, l.IsValid());
        }
Exemplo n.º 6
0
        public void IsValidReturnsFalseWhenNoPossibleSolutionsExist()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l.Fill(0, 3, Cell.CellState.Filled);
            l[4].State = Cell.CellState.Filled;
            l.Hints.AddRange(new int[] { 3 });

            Assert.AreEqual(false, l.IsValid());
        }
Exemplo n.º 7
0
        public void IsValidReturnsFalseWhenGroupIsTooLarge_Hint3_Contents4_right()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l[0].State = Cell.CellState.Blank;
            l.Fill(1, 4, Cell.CellState.Filled);
            l.Hints.AddRange(new int[] { 3 });

            Assert.AreEqual(false, l.IsValid());
        }
Exemplo n.º 8
0
        public void IsValidReturnsTrueWhenNotEnoughGroups_Hint111_Contents11()
        {
            Nonogram n = new Nonogram(5, 1);
            CellLine l = n.Row(0);

            l[0].State = l[2].State = Cell.CellState.Filled;
            l[1].State = l[3].State = Cell.CellState.Blank;
            l.Hints.AddRange(new int[] { 1, 1, 1 });

            Assert.AreEqual(true, l.IsValid());
        }