ConceptStep · learning platform for computer science

Test Case Lab: normal and boundary cases

C programming · Lesson

C · lesson 25 / 27

Test Case Lab: normal and boundary cases

Learn to choose inputs that genuinely test an algorithm instead of running it once with an easy value.

1 · Observe and predict

The concept

A good test set contains at least one normal case, values exactly on the boundaries, and values immediately before and after the boundaries. Boundary cases reveal errors that random input may miss.

Mental model:

specification 0..100, threshold 60 → try -1 | 0 | 59 | 60 | 75 | 100 | 101 → predict → run → compare

2 · Flowchart First

Follow the same algorithm as a flowchart

Use Start and Step: when the active block changes, ConceptStep also highlights the C lines representing that same step.

Loading flowchart…
3 · Flowchart ↔ C · Run in Page

Lab 1 — Run the example program

Run C executes only the example shown on the left, using stdin on the right. The coding challenge below has a separate editor and test button.

Test cases: normal values and boundaries Start the flowchart to synchronize the code
                        1#include <stdio.h>
                        2 
                        3int main(void)
                        4{
                        5    int voto;
                        6    scanf("%d", &voto);
                        7 
                        8    if (voto < 0)
                        9        printf("FUORI\n");
                        10    else if (voto > 100)
                        11        printf("FUORI\n");
                        12    else if (voto >= 60)
                        13        printf("SUFFICIENTE\n");
                        14    else
                        15        printf("INSUFFICIENTE\n");
                        16 
                        17    return 0;
                        18}
Ready. Make a prediction before running.

                    
                

Lab 2 — Coding challenge: write your code — Boundary checks

Read an integer score. Print INVALIDO outside 0..100; otherwise SUFFICIENTE if >=60 or INSUFFICIENTE.

This is a different program from lab 1. Complete the starter code: Check all test cases compiles this editor and tests every input, including boundary cases.

4 · Guided practice

Check your prediction

Which pair is most useful for checking that the passing threshold is implemented correctly?

Challenge 1 / 5 · Understanding

Progress: 0 / 5 · correct: 0

Your competency map

What you need to know for Test Case Lab: normal and boundary cases

ConceptStep separates what is required from what is recommended or useful as reinforcement. Only required prerequisites block your progress.

Current topic Strong skill Review due Needs reinforcement To be mastered Optional support

Relationships: solid line = required · dashed line = recommended · dotted line = reinforcement.

GUIDED LEARNING PATHS

Want to choose the next skill to develop?