示例#1
0
        public void Always_RZone_Test()
        {
            List <GamePlay> plays = loadSavedGamePlays(new List <string>()
            {
                "Combat1", "End"
            });

            foreach (GamePlay gp in plays)
            {
                // test that this specifation is respected by each game-play:
                List <Tuple <uint, Pack> > tplist = new List <Tuple <uint, Pack> >();

                foreach (Pack p in G.dungeon.alivePacks)
                {
                    Tuple <uint, Pack> a = new Tuple <uint, Pack>(G.dungeon.level(p.location), p);
                }

                for (int i = 0; i < tplist.Count; i++)
                {
                    Specification S = new Always(G => G.dungeon.level(tplist[i].Item2.location) == tplist[i].Item1);
                }

                gp.replay(S);
                Assert.IsTrue(S.getVerdict());
            }
        }
示例#2
0
        public void test_packs_never_leave_zone()
        {
            List <ReplayGamePlay> plays = loadSavedGamePLays(files);

            foreach (ReplayGamePlay gp in plays)
            {
                Always al = new Always(G => Specification.AllPacks(G, (P => (G.dungeon.zone[P.zone]).Contains(P.location))));
                Assert.IsTrue(gp.replay(al), gp.FileName + " failed");
            }
        }
示例#3
0
        public void test_node_never_over_capacity()
        {
            List <ReplayGamePlay> plays = loadSavedGamePLays(files);

            foreach (ReplayGamePlay gp in plays)
            {
                Always al = new Always(G => Specification.AllNodes(G, (N => N.nMonsters() <= G.dungeon.M * (G.dungeon.level(N) + 1))));
                Assert.IsTrue(gp.replay(al), gp.FileName + " failed");
            }
        }
示例#4
0
        public void Always_RNode_Test()
        {
            List <GamePlay> plays = loadSavedGamePlays(allReplays);

            foreach (GamePlay gp in plays)
            {
                Specification S = new Always(G => check_nodes(G));
                gp.replay(S);
                Assert.IsTrue(S.getVerdict());
            }
        }
示例#5
0
        public void Always_RZone_Test()
        {
            List <GamePlay> plays = loadSavedGamePlays(allReplays);

            foreach (GamePlay gp in plays)
            {
                // test that this specifation is respected by each game-play:
                List <Tuple <uint, string> > tplist = new List <Tuple <uint, string> >();

                Game game = new Game(gp);

                foreach (Pack p in game.dungeon.alivePacks)
                {
                    Tuple <uint, string> a = new Tuple <uint, string>(game.dungeon.level(p.location), p.id);
                }

                Specification S = new Always(G => check_packs(G, tplist));
                gp.replay(S);
                Assert.IsTrue(S.getVerdict());
            }
        }
示例#6
0
        public void LevelShrinksTest()
        {
            List <GamePlay> plays = loadSavedGamePlays(new List <string>()
            {
                "Shrink"
            });

            foreach (GamePlay gp in plays)
            {
                int startGraphSize      = Predicates.reachableNodes(gp.getGame().dungeon.startNode).Count;
                List <Specification> XS = new List <Specification>()
                {
                    new LeadsTo(G => startGraphSize == Predicates.reachableNodes(G.dungeon.startNode).Count, G => Predicates.reachableNodes(G.dungeon.startNode).Count < startGraphSize)
                };


                Specification S = new Always(G => G.gp.PlayerCommands.OfType <UseItemCommand>().Where(x => x.option == 1).Count() > 1);

                gp.replay(S);
                Assert.IsTrue(S.getVerdict());
            }
        }