Asserts invarious languages.
public class App {
public static void main(String[] args) {
/* data to test against */
int[][] m = {{12,12,11},{9,8,31},{2,16,24}};
/* test to run to verify the data */
for (int[] i : m) {
asserts(i.length == m.length,"input 2D array is not a square");
}
}
/* provides clean assert usage for cleaner debugging
* by: CodyKochmann
*/
private static void asserts(boolean test,String message){
if(test == false){
System.out.println("Assertion Error: " + message);
System.exit(0);
}
}
}
let test = false;
assert!(test, "test wasn't true!");
i=0
assert isinstance(i,int), "i needs to be an int"
$dogs=5;
assert('isset($dogs); /* dog must be set before this is called. */');
echo $dogs;