Download presentation
Presentation is loading. Please wait.
1
CS 280 Data Structures Professor John Peterson
2
Next Project YET ANOTHER SORT! We’ll do Quicksort using links instead of arrays. Wiki time.
3
Using Generic Pairs Let’s write a simple method for integer division using repeated subtraction: x / y = (0, x) if x < y = (a+1, b) where (a,b) = (x – y) / y
4
Unit Testing Basic idea: write a program to test your program use an existing framework to organize tests build testing infrastructure that will make it easy to test components Avoid cross contamination Use NetBeans to generate test files
5
Testing Strategies Specific input / output relations Corner cases Tests that address coverage – make sure every branch of every if is tested Tests of algebraic properties – these can incorporate arbitrary data items Tests that address aliasing / sharing Randomized tests
6
Implementing These Strategies Lets write tests on “eo” that deal with these strategies
7
JUnit Items to Note The use of setup/teardown is important – this avoids contaminating tests The JUnit files live in a different place. There’s a “test project” on the run menu that lets you easily test changes in your code. Get in the habit of always testing after changing your program! You have to write some infrastructure to make testing easier
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.