Assert Statements ================= ```Example from 1 languages: C #include <assert.h> int i, a[10]; for (i = 0; i < 10; ++i) { assert(0 <= i && i < 10); a[i] = 10-i; } for (i = 0; i < 10; ++i) { assert(0 <= i && i < 10); assert(0 <= a[i] && a[i] < 10); a[a[i]] = a[i]; } ``` ```Example from 1 languages: Java // By default, assertions are disabled // java –enableassertions Test int score = 10; assert score >= 10 : " Below"; System.out.println("score is "+score); ``` ```Example from 1 languages: C3 assert(a > 0, "Expected a positive number"); $assert(Foo.sizeof == 8, "Foo sizecheck at compile time failed"); ``` ```Example from 1 languages: Jule use std::debug use std::debug::assert::{assert} fn main() { std::debug::ENABLE = true let x = 200 assert(x < 200) } ``` ```Example from 1 languages: Speedie class Person |int| age setter age // "expect" will actually add an Error to a list of errors expect (value >= 0) ("bad age $value set!") .age = value main || p = person() p.age = -10 if !stderr.ok "Oof we got some errors" ``` * Languages *with* Assert Statements include C, Java, C3, Jule, Speedie * Languages *without* Assert Statements include progsbase * View all concepts with or missing a *hasAssertStatements* measurement http://pldb.info/../lists/explorer.html#columns=rank~id~appeared~tags~creators~hasAssertStatements&searchBuilder=%7B%22criteria%22%3A%5B%7B%22condition%22%3A%22null%22%2C%22data%22%3A%22hasAssertStatements%22%2C%22origData%22%3A%22hasAssertStatements%22%2C%22type%22%3A%22num%22%2C%22value%22%3A%5B%5D%7D%5D%2C%22logic%22%3A%22AND%22%7D missing http://pldb.info/../lists/explorer.html#columns=rank~id~appeared~tags~creators~hasAssertStatements&searchBuilder=%7B%22criteria%22%3A%5B%7B%22condition%22%3A%22!null%22%2C%22data%22%3A%22hasAssertStatements%22%2C%22origData%22%3A%22hasAssertStatements%22%2C%22type%22%3A%22num%22%2C%22value%22%3A%5B%5D%7D%5D%2C%22logic%22%3A%22AND%22%7D with * Read more about Assert Statements on the web: 1. https://en.wikipedia.org/wiki/Debug_code#Assert_Statements 1. Built with Scroll v178.2.3