Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
4afe89e0
Commit
4afe89e0
authored
Apr 05, 2021
by
Kim Nguyễn
Browse files
Add one more test.
parent
954e38e3
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
old/tests/misc/bib.xml
deleted
100644 → 0
View file @
954e38e3
<?xml version="1.0" standalone="yes"?>
<bib>
<book>
<title>
Persistent Object Systems
</title>
<year>
1994
</year>
<author>
M. Atkinson
</author>
<author>
V. Benzaken
</author>
<author>
D. Maier
</author>
</book>
<book>
<title>
OOP: a unified foundation
</title>
<year>
1997
</year>
<author>
G. Castagna
</author>
</book>
</bib>
old/tests/misc/biblio.cd
deleted
100644 → 0
View file @
954e38e3
type Biblio =
<bibliography>
[Heading Paper*];;
type Heading =
<heading>
[ PCDATA ];;
type Paper =
<paper>
[Author+ Title ((Conference Series?) |(Journal Volume? Number)) Publisher? Year File Abstract?];;
type Author =
<author>
[ PCDATA ];;
type Title =
<title>
[ PCDATA ];;
type Conference =
<conference>
[ PCDATA ];;
type Series =
<series>
[ PCDATA ];;
type Journal =
<journal>
[ PCDATA ];;
type Publisher =
<publisher>
[ PCDATA ];;
type Volume =
<volume>
[ Int ];;
type Number =
<number>
[ Int ];;
type Year =
<year>
[ 1970--2010 ];;
type File =
<file>
[ PCDATA ];;
type Abstract=
<abstract>
Text;;
type Text = [ PCDATA ];;
type Html =
<html>
[Head? Body];;
type Head =
<head>
[
<title>
[ PCDATA ] ];;
type Body =
<body>
[Mix*];;
type Mix =
<h1>
[Mix*]
|
<a
href=
String
>
[Mix*]
|
<p>
[Mix*]
|
<em>
[Mix*]
|
<ul>
[
<li>
[Mix*] +]
| Char;;
let fun do_authors ([Author+] -> [Mix*])
| [
<author>
a ] -> a
| [
<author>
a
<author>
b ] -> a @ " and, " @ b
| [
<author>
a; x] -> a @ ", " @ (do_authors x);;
let fun do_paper (Paper ->
<li>
[Mix*])
|
<paper>
[ x::_*
<title>
t
<_>
c _*
<year>
_
<file>
f _* ] ->
(* Here, type inference says: x : [Author+] ... *)
let authors = do_authors x in
<li>
([
<a
href=
f
>
t ] @ authors @ "; in " @ [
<em>
c ] @ "." );;
let fun do_biblio (Biblio -> Html)
<bibliography>
[
<heading>
h; p ] ->
let body = match p with
| [] -> "Empty bibliography"
| l -> [
<h1>
h
<ul>
(map l with x -> do_paper x) ]
in
<html>
[
<head>
[
<title>
h ]
<body>
body ];;
let bib : Biblio =
<bibliography>
[
<heading>
"Alain Frisch's bibliography"
<paper>
[
<author>
"Alain Frisch"
(*
<author>
"Giuseppe Castagna"
<author>
"Vronique Benzaken" *)
<title>
"Semantic subtyping"
<conference>
"LICS 02"
<year>
[2002]
<file>
"semsub.ps.gz"
<abstract>
[ 'In this work,...' ]
]
(*
<paper>
[
<author>
"Mariangiola Dezani-Ciancaglini"
<author>
"Alain Frisch"
<author>
"Elio Giovannetti"
<author>
"Yoko Motohama"
<title>
"The Relevance of Semantic Subtyping"
<conference>
"ITRS'02"
<year>
[2002]
<file>
"itrs02.ps.gz"
]
<paper>
[
<author>
"Vronique Benzaken"
<author>
"Giuseppe Castagna"
<author>
"Alain Frisch"
<title>
"CDuce: a white-paper"
<conference>
"PLANX-02"
<year>
[2002]
<file>
"planx.ps.gz"
]
*)
];;
do_biblio bib
;;
(*
[bib]/
<papr>
_/
<author>
_;;
*)
\ No newline at end of file
tests/full/good/dune.auto
View file @
4afe89e0
...
...
@@ -6,9 +6,18 @@
(rule (alias addrbook) (action (diff addrbook.exp addrbook.out)))
; end: addrbook.cd
; begin: integers.cd
(rule (deps integers.cd) (target integers.cdo)
(action (with-accepted-exit-codes 0 (run cduce --compile %{deps}))))
(rule (deps integers.cdo) (target integers.out)
(action (ignore-stderr (with-stdout-to %{target} (with-accepted-exit-codes 0 (run cduce --run %{deps}))))))
(rule (alias integers) (action (diff integers.exp integers.out)))
; end: integers.cd
(alias (name runtest)
(deps
(source_tree ../common)
(alias addrbook)
(alias integers)
))
old/
tests/
misc
/integers.cd
→
tests/
full/good
/integers.cd
View file @
4afe89e0
include "../common/utils.cd"
;;
let fun facto (Int -> Int)
| 0 | 1 -> 1
| n -> n * (facto (n - 1))
in
facto 10000;;
;;
print_value (
facto 10000
)
;;
(*
type Pos = 0--*;;
let fun abs (Int -> Pos)
| (x & Pos) -> x
| x -> 0 - x
in
abs (
0
-30);;
;;
print_value (
abs (-30)
)
;;
let fun wrap (0--100 -> 0--10)
| x & 0--10 -> x
| x -> wrap (x - 10)
in
wrap 67;;
;;
print_value (
wrap 67
)
;;
type Expr =
(`add, Expr, Expr)
...
...
@@ -33,6 +35,5 @@ let fun eval ( Expr -> Int )
| (`sub,x,y) -> eval x - eval y
| (`div,x,y) -> (eval x) div (eval y)
| n -> n
in
eval (`add, 10, (`add, 20, 5));;
*)
;;
print_value (eval (`add, 10, (`add, 20, 5)));;
tests/full/good/integers.exp
0 → 100644
View file @
4afe89e0
This diff is collapsed.
Click to expand it.
tests/full/src/dune
View file @
4afe89e0
(executable
(name gen_dune)
(libraries cduce_core)
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment