The Logic League
Does It Do What It Should

The Wonderful Weather Machine
The lost-and-found closet smelled like old sneakers and pencil shavings. Priya pushed past a rack of forgotten jackets to find the glowing laptop, already humming with soft green light.
"Ready?" she asked.
Sam bounced on their heels. "Ready!"
Kwame adjusted his journal. "We still need to check the weather interface."
"And fix the bug Lily found," Lily said, her eyes already scanning the screen. "I wrote it down."
Priya opened the laptop. The Grid's light washed over them, and then they were standing in the Outer Grid, in the corner they'd claimed as their own. In front of them stood their creation: the Weather Machine.
It was beautiful. A bright yellow box with a screen that showed three buttons—SUNNY, RAINY, CLOUDY—and a small door underneath that dispensed the appropriate weather. Well, it was supposed to.
"Show us what it does with SUNNY," Priya said.
Kwame pressed the button. The machine hummed. A warm golden glow spread across their corner of the Grid. Perfect.
"Rainy?" Lily tried.
Purple clouds gathered overhead. A soft drizzle pattered down. "Working," Sam reported.
"Cloudy?" asked Priya.
Gray mist curled around them. The machine hummed proudly.
"See?" Priya grinned. "It works."
Lily frowned. "It works for the buttons. But what about the other things?"
"What other things?" Priya asked.
Lily pulled out her notebook. "I pressed SUNNY twice. Watch what happens."
She pressed the button. Then she pressed it again. Instead of warmth, the machine spit out a blast of snow and ice. The yellow box shuddered.
ERROR: Input received outside expected sequence. Behaviour undefined.
"That's bad," Sam said quietly.
"Also," Lily reached behind the machine, "I tried to put more weather in the storage compartment, and found—" She held up a fistful of rainbow-colored static. "This. It's been building up."
Priya stared at the machine. "But we tested it. We tested all the buttons."
"We tested what we expected," Kwame said slowly. "Maybe that's the problem."
The Case of the Something-Else
The kids huddled around Kwame's journal as he drew a diagram.
"When we built the Weather Machine, we made it like a story: press SUNNY, get sun. Press RAINY, get rain. Press CLOUDY, get clouds." He looked up. "But a story only has one path. A program has many."
"What does that mean?" Sam asked.
"It means we only checked the story we wanted to happen," Lily said. "We didn't check the other ways someone might use it."
"The double-press was a surprise," Kwame said. "And surprises in code are bad."
Priya felt her cheeks warm. She'd been so sure the machine was finished. "So how do we make sure it does what it should? All the time?"
Lily brightened. "We test it. Not just with things we expect, but with things we don't."
"How?" Sam asked.
"By asking lots of questions," Lily said. "What if someone presses two buttons at once? What if they press nothing for a long time? What if they press a button five times fast?"
"That's a lot of cases," Sam said.
"Exactly!" Lily's eyes lit up. "And we can think about them before they happen. That's what testing is. Thinking about all the ways something could go wrong before it does."
The machine hummed, and a single drop of rain fell on Priya's nose.
"First," Lily said, pulling out another notebook, "we make a list. What are the expected cases?"
"Press SUNNY, get sun," said Kwame.
"Press RAINY, get rain."
"Press CLOUDY, get clouds."
Lily wrote them down. "Now," her pencil hovered, "what are the unexpected cases?"
The Edge-Case Hunt
"The double-press," Lily said. "We need to decide what that means."
"What could it mean?" Priya asked.
Sam raised their hand. "Maybe it means the weather should be extra? Like double-sunny?"
Priya tilted her head. "Or maybe pressing twice shouldn't do anything, because one press is enough."
"A program should have a defined behavior for every input," Kwame said slowly, turning it into a story. "The machine doesn't get to invent its own plot. We have to write the whole script, not just the happy parts."
Lily handed out pieces of paper. "Let's map the edge cases. That's what we call the unexpected ones—the edges of what can happen."
They worked together, coming up with case after case:
-
What if you press two buttons at once?
-
What if you press a button and then immediately change your mind?
-
What if you press the same button every single second for a minute?
-
What if someone presses a button while the machine is still making weather?
The Weather Machine sat in the middle of their circle, humming innocently.
"Also," Sam said, looking at the storage compartment behind the machine, "what if we run out of rain? Or sun?"
"How would we run out?" Priya asked.
"In our tests, we used a little rain and a little sun. But what if someone requests rain all day? The tank has a limit."
Kwame frowned. "Sam's right. We didn't decide what happens when the weather runs out."
Lily drew a line under her list. "So we have two questions for each case: What should happen? And what should not happen?"
They marked their answers. For double-press: nothing. The machine should ignore it. For two buttons at once: show a message: "Please select one weather type." For running out: stop and say, "Storage empty. Please refill."
They gave each rule a clear name. They wrote them all down.
"Now," said Lily, "we fix the machine. And then we test again."
The Test That Made It Better
Fixing the machine took work. They added a rule at the beginning: "If the machine is already making weather, ignore new requests." They added another: "If the weather storage is empty, display the message and do nothing else."
Each fix was small. Each fix was tested.
"Double-press," Kwame said.
Lily pressed SUNNY, then immediately pressed SUNNY again.
The machine glowed warm. Golden light. No snow.
"Double-press: fixed," Lily announced.
"Two buttons," Priya said.
Sam pressed SUNNY and RAINY at the same time.
The machine displayed: Please select one weather type.
"Two buttons: fixed," Sam said.
"Running out of weather," Lily said. She pressed RAINY five times, then reached into the storage compartment. "I emptied the rain tank during our tests." She pressed RAINY again.
The machine displayed: Storage empty. Please refill. And it did nothing else. No stray clouds. No confused puddle on the floor.
"Fixed," she said. "And there's one more test. The weirdest one."
She pressed CLOUDY, waited, then pressed CLOUDY, RAINY, SUNNY, and CLOUDY again in quick succession.
The machine did exactly what each button asked, in order. Gray mist. Rain. Golden light. Gray mist again.
ALL TESTS PASSED.
The kids stared at the machine. It hummed happily, dispensing weather with quiet confidence.
Priya let out a long breath. "So... it works now?"
"It worked before," Lily said. "We just didn't know what 'working' meant yet. Now we know what it should do in every case. Or at least, every case we could think of."
"And when we think of new cases," Kwame said, opening his journal, "we'll test those too. Because the machine never stops being used, and we never stop testing."
Kwame's Journal
That night, back in the lost-and-found closet, Kwame wrote:
The Weather Machine was like a story with chapters we hadn't written. We only told the happy parts—the sunny days, the gentle rain. But stories have other pages too: the unexpected chapter where the hero presses the button twice, the surprise plot twist where the rain runs dry. A good story doesn't leave those pages blank. A good story explains what happens in every chapter, even the ones you hope you'll never read. Testing is how you read your program's future before it happens. It's how you make sure every page has something true on it.
He closed his journal.
"Do you think there are still bugs?" Sam asked.
"Definitely," Lily said, without hesitation. "There are always more edge cases. But now we know how to find them."
"And fix them," Priya added.
"Exactly," Lily said, smiling. "That's what testing is. Not proving it works. Making it work—for everyone, in every case, even the ones you didn't think of."
The laptop glowed softly, waiting for their next adventure. And somewhere in the Grid, the Weather Machine hummed on—ready for sunny, ready for rain, and ready for whatever unexpected thing might come next.