aboutsummaryrefslogtreecommitdiff
path: root/tests/i
diff options
context:
space:
mode:
Diffstat (limited to 'tests/i')
-rw-r--r--tests/i/template-unused/case.json1
-rw-r--r--tests/i/template-unused/expected.txt1
-rw-r--r--tests/i/template-unused/lib.cps48
-rw-r--r--tests/i/template-unused/notes.md5
-rw-r--r--tests/i/template-unused/program.cps2
5 files changed, 57 insertions, 0 deletions
diff --git a/tests/i/template-unused/case.json b/tests/i/template-unused/case.json
new file mode 100644
index 0000000..3415f39
--- /dev/null
+++ b/tests/i/template-unused/case.json
@@ -0,0 +1 @@
+{"sources": ["program.cps", "lib.cps"]}
diff --git a/tests/i/template-unused/expected.txt b/tests/i/template-unused/expected.txt
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/tests/i/template-unused/expected.txt
@@ -0,0 +1 @@
+7
diff --git a/tests/i/template-unused/lib.cps b/tests/i/template-unused/lib.cps
new file mode 100644
index 0000000..3de8ac3
--- /dev/null
+++ b/tests/i/template-unused/lib.cps
@@ -0,0 +1,48 @@
+TEMPLATE <T>
+FUNCTION Identity(Value : T) RETURNS T
+ IF Value < Value THEN
+ RETURN (T)Value
+ ENDIF
+ RETURN Value
+ENDFUNCTION
+
+TEMPLATE <T, Rest...>
+OVERLOAD PROCEDURE Visit(First : T, Others : Rest...)
+ OUTPUT Identity<T>(First)
+ CALL Visit<Rest...>(Others...)
+ Visit<Box<Pair<INTEGER,REAL>>>(Others...)
+ENDPROCEDURE
+
+TEMPLATE <T>
+CLASS Box
+ PRIVATE Value : T
+ PUBLIC PROCEDURE NEW(V : T)
+ Value <- V
+ ENDPROCEDURE
+ PUBLIC FUNCTION Get() RETURNS T
+ RETURN Value
+ ENDFUNCTION
+ PUBLIC FUNCTION AsBox(V : Box<T>) RETURNS Box<T>
+ RETURN (Box<T>)V
+ ENDFUNCTION
+ENDCLASS
+
+TEMPLATE <A, B>
+CLASS Pair
+ Left : A
+ Right : B
+ENDCLASS
+
+TEMPLATE <T, Rest...>
+CLASS Bundle
+ PUBLIC PROCEDURE Send(Values : Rest...)
+ CALL Visit(Values...)
+ ENDPROCEDURE
+ENDCLASS
+
+TEMPLATE <T>
+PROCEDURE NestedTypes(Value : Box<Box<T>>)
+ DECLARE Other : Box<Pair<T,REAL>>
+ Other <- NEW Box<Pair<T,REAL>>()
+ Value <- (Box<Box<T>>)Value
+ENDPROCEDURE
diff --git a/tests/i/template-unused/notes.md b/tests/i/template-unused/notes.md
new file mode 100644
index 0000000..c3ff7fd
--- /dev/null
+++ b/tests/i/template-unused/notes.md
@@ -0,0 +1,5 @@
+# template-unused
+
+Human review: pending. Expected output was independently traced by AI, not captured from cpsc.
+
+Basis: TEMPLATE is a project extension. The library holds unused function, class and variadic templates, including casts, nested type ids, explicit calls and pack forwarding. Their bodies are parsed without being emitted or counted as top-level code. The entry unit prints INTEGER 7.
diff --git a/tests/i/template-unused/program.cps b/tests/i/template-unused/program.cps
new file mode 100644
index 0000000..d8b89a2
--- /dev/null
+++ b/tests/i/template-unused/program.cps
@@ -0,0 +1,2 @@
+INCLUDE "lib.cps"
+OUTPUT 7