Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

LinkedIN Community

Join our LinkedIN Community.

Cite this work

Use the following BibTeX entry to cite this work:

@INPROCEEDINGS{DVMB2023,
  author={Doorn, Niels and Vos, Tanja and Marín, Beatriz and Barendsen, Erik},
  booktitle={2023 IEEE Conference on Software Testing, Verification and Validation (ICST)}, 
  title={Set the right example when teaching programming: Test Informed Learning with Examples (TILE)}, 
  year={2023},
  volume={},
  number={},
  pages={269-280},
  doi={10.1109/ICST57152.2023.00033}
}

Calculating the mean of positive and negative numbers

Implement a program that reads 12 real numbers and calculates the mean of the positive and negative numbers. Afterwards, the result must be displayed to a maximum of 4 decimal places. Run the following test cases to test your program:

test case ID inputs   expected outputs
    mean of positives mean of negatives
1 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 6.5 0
2 -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12 0 -6.5
3 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0 0
4 12.4, 21.005, -3.67, 4.43, 5.56, 4.2, 7, 8.3, -91.3, -1.0, 32.4, 12.1 11.9327 -31.99
Insist that the students test their programs by giving them example
test cases in a table. Series with only positive numbers, series
with only negative numbers, all zeros, and mix of positive/negative.