Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » debugging » generateAssertions
next | previous | forward | backward | up | index | toc

# generateAssertions -- generate assert statements from experimental input

- Usage:
    `generateAssertions x`
- Inputs:
  - x, a string whose non-comment non-blank lines are Macaulay2 expressions to be evaluated
- Outputs:
  - a net whose lines are assert statements that assert that the expressions evaluate to the expected value, just computed

## Description

    i1 : generateAssertions ///
         	2+2
         	2^20
         	///

    o1 =
         assert( (       2+2) === 4 );
         assert( (       2^20) === 1048576 );

    i2 : value \ unstack oo

    o2 = {, }

    o2 : List

## Ways to use generateAssertions:

- `generateAssertions(String)`

## For the programmer

The object generateAssertions is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/check-doc.m2:144:0.