Download presentation
Presentation is loading. Please wait.
Published byLynette Dalton Modified over 9 years ago
1
1 “Embedded” Dominion NO GUI, NO NETWORK, NO NOTHING NO REAL USER INTERFACE You may want to build a limited UI for testing A simple text interface is in the directory Only need to implement cards in the enum If we’re missing state needed for other cards, don’t worry about it Assume “customer” use is for simulation of various strategies, rather than real game play Caller will be other code, and cards with “interactive” decisions are not included
2
2 “Embedded” Dominion Support 2-4 players (ignore Intrigue’s support for more players) Use cards played to determine what phase someone is in: While playing actions, in Phase A Buying a card indicates moving to B Calling endTurn() ends turn Return -1 if their choice is illegal AND DO NOT CHANGE THE STATE All supply piles are ‘face up’ – only deck is face down
3
3 Implementing Dominion: Your Job Copy over all the stuff in the dominion directory in the repository to: PROJECT/dominion-code/ Only file you should change, in this directory, is dominion.c Your task: Implement buyCard correctly (or at least sort of correctly! Right now it is VERY wrong) Implement the adventurer card That’s it.
4
4 Implementing Dominion: Getting Started You might want to look at the rules We’ll play some in class! Start simple. Understand drawCard. We’ll look at it in class, and test it in class.
5
5 “Embedded” Dominion Player 0 is always starting player Over multiple games, we’ll need to reassign player numbers, if following the rules – responsibility of calling code, not our code Means we have enough info to compute tiebreakers… Right? Deck is sorted before shuffle, so as long as you have the right cards in the discard pile (then move them to deck before shuffling) it doesn’t matter what order things go in discard pile (or played card area)
6
6 Question Time, Inspect the Code
7
7 Tools you SHOULD use gcov http://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Gcov.html/ I included flags to use it in the makefile Basic minimal tool use; you must show me coverage #s! Delta-debugging http://www.st.cs.uni-saarland.de/dd/ Minimization for test cases Code is in python, but very easily adapted even if you don’t know python If you want, we can try it out in class today? Also a good basic point for tools; courtesy to developer, and it will please me as well
8
8 Tools GinkoTest In the repository Possibly buggy! Use with caution Unit testing tool There are others out there.
9
9 Tools: Concolic Testing CREST (Successor to CUTE) http://neutrinographics.com/concolic-testing-and-fault- localization-0 http://neutrinographics.com/concolic-testing-and-fault- localization-0 I haven’t really used it myself; you’re somewhat on your own Might very well automatically generate all the tests you’d care to have Splat Looks like when Ru-Gang graduated, at some point UCLA reclaimed his web pages, which had the download link Probably best not to try for it, given that IN OTHER WORDS: BEWARE OF THESE
10
10 Tools: Concolic Testing KLEE: Not quite concolic, just symbolic, but works much better than the others Should be able to handle dominion ok, though I have not personally tried this yet
11
11 Tools: Runtime Analysis Daikon http://groups.csail.mit.edu/pag/daikon/ Generally up to date I haven’t used this on C programs in a couple of years; do not know the current method well We can try it out in class, if you wish Valgrind http://valgrind.org/downloads/ Linux only Good for finding memory allocation / access errors
12
12 Tools: Static Analysis Uno http://spinroot.com/uno/ Static analysis for C code We’ll discuss static analysis a bit later in class, briefly Could give you a hint as to bugs before you test, if you feel like brave exploration
13
13 Tools: Model Checking Spin http://spinroot.com/spin/whatispin.html Backtracking exploration (“explicit-state model checking”) for C programs Topic of class soon (once we’re done with debugging)! If you want to download/start playing, I suggest grabbing it and then looking in the SPIN directory in the repository CBMC http://www.cprover.org/cbmc/ Bounded model checking: exhaustive up to loop bounds On Windows, needs a Visual Studio install Useful more on small pieces of dominion than on whole program!
14
14 HOW TESTS SHOULD RUN You turn in code such that: Copy a dominion.c (only file your implementation should use) into the test directory > make testdom >./testdom Produces output in test.out (maybe other files if you need them) describing the testing done and what the results were
15
15 THE PROJECT REPORT Contents: Detailed discussion of test approach taken I want to see source code – show, don’t just tell Not a dump of all your code, but representative portions to indicate any of these that apply: Structure of a test case Length of test cases Method for choosing inputs Specification method used How to handle segfaults/crashes Development history of the test system Areas particularly well tested, areas that have not been thoroughly tested – remaining risks of failure Complete set of test statistics gathered: coverages, number of tests performed, number of faults detected, etc.
16
16 THE PROJECT REPORT Contents: Detailed discussion of the test process Communications with partners Give some representative examples, show me what a bug report and response looked like Revisions to tested code (and to tester) Regression strategy, regression failures discovered Quality of code on first testing Quality of code when finished Lines of code at beginning, when finished Final status of all bugs reported so far (FIXED, WONTFIX, BOGUS…) Details of bugs (possibly of all discovered bugs, if it fits), including the severity, nature, fix, pointer to test case (or full test case if it is small enough)
17
17 THE PROJECT REPORT Contents: Opinions for future testers What would you have done differently, given time How well did any tools you used work? What infrastructure did you develop or did you need How useful was automated testing vs. hand unit tests vs. code inspection, in your case? I expect a written document rather than a powerpoint here. Ok, it it’s a REALLY GOOD powerpoint, fine. I doubt you can do it in less than 5 pages. That is not a challenge to do it in 4.
18
18 GENERAL WARNINGS & CAUTIONS Do not just trust that svn is working for you CONFIRM YOUR COMMITS Browse source in the beaversource repository CONFIRM YOUR COMMITS svn add Adds this directory to the repository, but does not check it in Doesn’t actually DO anything by itself svn ci –m “my message” This checks in everything below the current directory Don’t imagine you can do the whole project late in the term, since the early plan/reports aren’t many points. You can’t. There is a strong correlation between “did not turn in the early stuff” and “got a bad grade on the project” “If you start late, you’re going to arrive late” (speeding doesn’t actually get you there that much sooner)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.