Skip to content

Test Programs

Lexi edited this page Nov 21, 2024 · 1 revision

General Program Structure

Potato.p

Purpose:
Baseline test for a syntactically valid empty program.

Concepts:

  • Basic program structure.
  • Handling of edge cases (empty main body).

Test:

  • Recognizes a valid entry point.
  • Handles an empty {} block.

Input, Output, and Expressions

Potato1.p: Text and Output Formatting

Purpose:
Tests the bite statement for output formatting.

Test:

  • String manipulation.
  • Escape sequences.
  • Concatenated and multi-line output.

Potato2.p: Operators and Expressions

Purpose:
Validates the use of arithmetic, logical, and comparison operators.

Test:

  • Arithmetic, logical, and comparison operations.
  • Aliases for standard operators.
  • Boolean evaluations.

Potato3.p: Variables, Constants, and Error Handling

Purpose:
Explores variable declaration, constants, arithmetic operations, and static errors.

Test:

  • Variable and constant initialization.
  • Compound assignments and operations.
  • Static and dynamic error handling.

Conditional Logic

Potato4.p: Conditional Statements

Purpose:
Tests branching logic with bake, elbake, and else statements.

Test:

  • Execution flow of simple, multi-way, and nested conditions.
  • Relational and logical operator validation.

Loop Logic

Potato5.p, Potato6.p, Potato7.p: Iteration Structures

Purpose:
Demonstrates season, fryAsLongAs, and do ... fryAsLongAs loops for various scenarios.

Test:

  • Standard loops with increments (Test Case 1).
  • Nested loops (Test Case 4).
  • Boundary and edge conditions (Test Case 3 and Test Case 6).
  • Infinite loops, dynamic variable updates, and multiple exits (Test Cases 7, 10, 11).

Concepts:

  • Iteration with pre- and post-condition evaluation.
  • Handling of special cases and dynamic updates.
  • Nested and infinite loop handling.

Assertions

Potato8.p

Purpose:
Tests assertion functionality, handling passing and failing cases with runtime stability.

Test:

  • Logical operators in assertions.
  • Integration of assertions with conditions.
  • Runtime errors for failed assertions.