Here’s the translation of the Go testing and benchmarking example to Ada:
To run this Ada program, you would typically compile it and then run the resulting executable. The exact commands may vary depending on your Ada compiler, but with GNAT it might look like this:
Note that Ada doesn’t have a built-in testing framework like Go’s testing package. In practice, Ada projects often use external testing frameworks like AUnit. The benchmarking facility shown here is a simple timing mechanism and doesn’t provide the same level of detail as Go’s benchmarking tools. For more sophisticated benchmarking in Ada, you might use external profiling tools or create more detailed timing mechanisms.
Ada’s strong typing and compiler checks can catch many errors at compile-time, reducing the need for certain types of runtime tests. However, unit testing is still an important practice in Ada development for ensuring correct behavior of complex logic.