new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
1
Task/Assertions/Ada/assertions-1.ada
Normal file
1
Task/Assertions/Ada/assertions-1.ada
Normal file
|
|
@ -0,0 +1 @@
|
|||
pragma Assert (A = 42, "Oops!");
|
||||
3
Task/Assertions/Ada/assertions-2.ada
Normal file
3
Task/Assertions/Ada/assertions-2.ada
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
with Ada.Assertions; use Ada.Assertions;
|
||||
...
|
||||
Assert (A = 42, "Oops!");
|
||||
9
Task/Assertions/C/assertions-1.c
Normal file
9
Task/Assertions/C/assertions-1.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include <assert.h>
|
||||
|
||||
int main(){
|
||||
int a;
|
||||
/* ...input or change a here */
|
||||
assert(a == 42); /* aborts program when a is not 42, unless the NDEBUG macro was defined */
|
||||
|
||||
return 0;
|
||||
}
|
||||
12
Task/Assertions/Eiffel/assertions-1.e
Normal file
12
Task/Assertions/Eiffel/assertions-1.e
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class MAIN
|
||||
creation main
|
||||
feature main is
|
||||
local
|
||||
test: TEST;
|
||||
do
|
||||
create test;
|
||||
|
||||
io.read_integer;
|
||||
test.assert(io.last_integer);
|
||||
end
|
||||
end
|
||||
1
Task/Assertions/Perl/assertions-1.pl
Normal file
1
Task/Assertions/Perl/assertions-1.pl
Normal file
|
|
@ -0,0 +1 @@
|
|||
open my $fh, '<', 'file' or die "Cannot open file: $!\n"; # $! contains the error message from the last error
|
||||
3
Task/Assertions/PicoLisp/assertions-1.l
Normal file
3
Task/Assertions/PicoLisp/assertions-1.l
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
...
|
||||
~(assert (= N 42)) # Exists only in debug mode
|
||||
...
|
||||
13
Task/Assertions/Racket/assertions-1.rkt
Normal file
13
Task/Assertions/Racket/assertions-1.rkt
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#lang racket
|
||||
|
||||
(define/contract x
|
||||
(=/c 42) ; make sure x = 42
|
||||
42)
|
||||
|
||||
(define/contract f
|
||||
(-> number? (or/c 'yes 'no)) ; function contract
|
||||
(lambda (x)
|
||||
(if (= 42 x) 'yes 'no)))
|
||||
|
||||
(f 42) ; succeeds
|
||||
(f "foo") ; contract error!
|
||||
4
Task/Assertions/Scala/assertions-1.scala
Normal file
4
Task/Assertions/Scala/assertions-1.scala
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
assert(a == 42)
|
||||
assert(a == 42, "a isn't equal to 42")
|
||||
assume(a == 42)
|
||||
assume(a == 42, "a isn't equal to 42")
|
||||
3
Task/Assertions/Smalltalk/assertions-1.st
Normal file
3
Task/Assertions/Smalltalk/assertions-1.st
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
foo := 41.
|
||||
...
|
||||
self assert: (foo == 42).
|
||||
Loading…
Add table
Add a link
Reference in a new issue