Docsity

CS 200 Lab Week 2: Grammar Exercises, Testing and Debugging - Prof. Asa Ben-Hur, Study notes of Computer Science

Partial preview of the text

Download CS 200 Lab Week 2: Grammar Exercises, Testing and Debugging - Prof. Asa Ben-Hur and more Study notes Computer Science in PDF only on Docsity!

CS 200 Lab, week 2

โ— Hand back quiz 1 โ— Grammar exercises โ— Testing and debugging

Grammars

โ— Describe the strings that can be produced by the following grammars:

  • (^) โ†’ , โ†’ ab, โ†’ bb
  • (^) โ†’ , โ†’ , โ†’ aa, โ†’ aa, โ†’ b, โ†’ b
  • (^) โ†’ โ†’ 0 | 1 | 0 โ†’ 1

Testing and Debugging

โ— Testing individual classes โ— Testing your whole program โ— Using the Eclipse debugger โ— Testing exercise

Testing

โ— You arenโ€™t done with your code until you have tested it!

Testing Strategies

โ— Focus each test case on a specific requirement โ— Make test cases small โ— Make sure to test all requirements โ— Remember to test exception and error cases!

Testing Exercise

โ— Code and specification are available on the recitations page โ— Create test cases for this program โ— Can place your test cases in a public directory and access othersโ€™ test cases there โ— First, weโ€™ll go through an example with the debugger...