# Official ZPE/YASS documentationAssertion and unit tests

ZPE 1.7.0 added capability for the assertion construct. Although its syntax makes it look like an internal function, it is not. Instead, ZPE's assertion is done in the interpreter much faster than a function can be run and is hard-coded into it.

Assertion is used in unit-testing. It can also be a powerful function of assessing your own assumptions of the expected output.

As teachers, assertions can be used to check the answers of students very quickly. Take the following sample of YASS code below:

YASS
```//Students must give an example of a mathematical sequence that:
//Will give 13 as the third index of \$a
//Will give 34 as the fifth index of \$a

\$a = []
for(\$i = 0; \$i < 10; \$i++)
\$x = \$i
\$a[\$i] = \$x
end for

asserts true(\$a, 13)
asserts true(\$a, 34)
```

For such a problem, a Fibonacci sequence could be generated that would solve the problem:

YASS
```//Students must give an example of a mathematical sequence that:
//Will give 13 as the third index of \$a
//Will give 34 as the fifth index of \$a

\$a = []
\$x = 2
\$y = 3

for(\$i = 0; \$i < 10; \$i++)
\$t = \$y
\$y = \$x + \$y
\$x = \$t

\$a[\$i] = \$y

end for

asserts true(\$a, 13)
asserts true(\$a, 34)

```

Educators and assessors can use this tool to verify students' code very quickly.

As well as the `asserts true` construct, there is also an `asserts false` construct, which will check that the equality is not there.

As of ZPE 1.7.8 (July 2018) assertion works differently in compiled programs. In fact, with the addition of compiler optimisations added in ZPE 1.7.8 assertion is no longer written to a compiled file.