File: test-type_any_type.R

package info (click to toggle)
r-cran-lambda.r 1.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 284 kB
  • sloc: sh: 9; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 729 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

rm(list=ls())
assert('type_any_type_1', {
  fib(n) %::% . : a
  fib(0) %as% 1
  fib(1) %as% 1
  fib(n) %as% { fib(n-1) + fib(n-2) }
  seal(fib)

  act <- fib(4)
  (act == 5)
})

rm(list=ls())
assert('type_any_type_2', {
  hypotenuse(a,b) %::% . : . : numeric
  hypotenuse(a,b) %as% { (a^2 + b^2)^.5 }
  seal(hypotenuse)

  act <- hypotenuse(3,4)
  (act ==5)
})

rm(list=ls())
assert('type_any_type_3', {
  hypotenuse(a,b) %::% numeric : numeric: .
  hypotenuse(a,b) %as% { (a^2 + b^2)^.5 }
  seal(hypotenuse)

  act <- hypotenuse(3,4)
  (act ==5)
})

rm(list=ls())
assert('type_any_type_4', {
  hypotenuse(a,b) %::% a : a: .
  hypotenuse(a,b) %as% { (a^2 + b^2)^.5 }
  seal(hypotenuse)

  act <- hypotenuse(3,4)
  (act ==5)
})