home / skills / bdambrosio / cognitive_workbench / test-calculate

test-calculate skill

/src/saved_plans/test-calculate

This skill tests and validates a calculate tool across arithmetic, trig, and variable substitution to ensure correct results.

npx playbooks add skill bdambrosio/cognitive_workbench --skill test-calculate

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
393 B
---
name: test-calculate
description: Tests calculate tool with arithmetic, trig, and variable substitution
manual_only: true
---

# Test Calculate Tool

Tests the calculate tool with:
- Basic arithmetic: 2 + 3 * 4 = 14
- Trig with degrees: projectile flight time formula
- Variable substitution: formula with {"v": 20, "theta": 30, "g": 9.8}
- Other functions: sqrt(16) + factorial(5) = 124

Overview

This skill exercises a calculate tool to validate arithmetic, trigonometry, and variable substitution in formula evaluation. It runs targeted checks like basic operations, degree-based trig for projectile motion, and combined functions such as square root and factorial. The goal is a quick, reliable verification of numerical parsing and execution behavior.

How this skill works

The skill sends formulas to the calculate tool and compares results against expected values. It covers basic operator precedence, trig functions interpreted in degrees, substitution of named variables into expressions, and composite function calls (e.g., sqrt and factorial). Failures indicate parsing, unit handling, or function implementation issues.

When to use it

  • Validate a calculator implementation or expression parser during development.
  • Verify trig functions handle degree input as required by the system.
  • Test variable substitution and scoped evaluation for dynamic formulas.
  • Confirm combined math functions (sqrt, factorial) execute correctly.
  • Include in CI to catch regressions in numeric evaluation logic.

Best practices

  • Run tests with clear expected outputs for each case to isolate failures.
  • Use representative numeric values, including edge cases (zero, negatives where allowed).
  • Ensure trig inputs are explicitly documented as degrees or radians to avoid ambiguity.
  • Include both simple and composite expressions to exercise parsing and function resolution.
  • Log intermediate results when a test fails to speed root-cause analysis.

Example use cases

  • Check basic arithmetic: verify 2 + 3 * 4 equals 14 to confirm operator precedence.
  • Verify trig in degrees: compute projectile flight time using v, theta, and g with theta in degrees.
  • Test variable substitution: evaluate a formula with {"v": 20, "theta": 30, "g": 9.8}.
  • Exercise other functions: confirm sqrt(16) + factorial(5) yields 124 to test combined functions.
  • Automated CI job that re-runs these checks after changes to the calculation engine.

FAQ

Does this skill assume trig inputs are degrees or radians?

Tests explicitly use degrees; document and confirm the calculator's expected unit to avoid mismatches.

What variable names are supported?

Use simple alphanumeric names like v, theta, and g; adapt tests if your evaluator enforces different naming rules.