Bug#990770: tcode -- add autopkgtests
Nilesh Patra
nilesh at debian.org
Tue Jul 6 18:09:29 BST 2021
Package: tcode
Version: 0.1.20080918-3
Severity: normal
Tags: patch
X-Debbugs-Cc: nilesh at debian.org
Dear Maintainer,
tcode does not have any autopkgtests at the moment,
I've attempted adding these, please consider applying the patch
Nilesh
-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 5.7.0-2-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages tcode depends on:
ii default-jre 2:1.11-72
pn latex2html <none>
pn texlive-bibtex-extra <none>
tcode recommends no packages.
tcode suggests no packages.
-------------- next part --------------
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..ac78501
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: run-unit-test
+Depends: @, default-jdk-headless
+Restrictions: allow-stderr
diff --git a/debian/tests/example-texjava.java b/debian/tests/example-texjava.java
new file mode 100644
index 0000000..2e775e9
--- /dev/null
+++ b/debian/tests/example-texjava.java
@@ -0,0 +1,52 @@
+\defclass{Complex}
+This class allows one to work with complex numbers of
+the form $a + bi$, where $a$ is the \emph{real} part of
+the number, \emph{b} is the imaginary part and
+$i=\sqrt{-1}$.
+\bigskip\hrule\bigskip
+\begin{code}
+public class Complex\begin{hide} {
+private double realPart;
+private double imagPart;\end{hide}
+public Complex (double realPart, double imagPart)\begin{hide} {
+this.realPart = realPart;
+this.imagPart = imagPart;
+}\end{hide}
+\end{code}
+\begin{tabb} Constructs a new {\tt Complex} number.
+\param{realPart}{The real part corresponding to $a$}
+\param{imagPart}{The imaginary part corresponding to $b$}
+\end{tabb}
+\begin{code}
+public Complex add (Complex c)\begin{hide} {
+realPart += c.realPart;
+imagPart += c.realPart;
+return this;
+}\end{hide}
+
+\end{code}
+\begin{tabb} Adds two complex numbers.
+\param{c}{The complex number to add to this one.}
+\return{This object, allowing to perform more than one operation
+on a single line of code.}
+\end{tabb}
+\begin{code}
+// other methods...
+public String toString()\begin{hide} {
+return "(" + realPart + " + " + imagPart + "i)";
+}
+// Test code
+public static void main(String[] args) {
+ Complex c1 = new Complex(1, 2);
+ Complex c2 = new Complex(2, 3);
+ assert c1.add(c2).toString().equals("(3.0 + 4.0i)");
+ System.out.println("PASS");
+}
+}\end{hide}
+\end{code}
+\begin{tabb}
+ Converts the number to a {\tt String} of
+the form {\tt a + bi}.
+\end{tabb}
+
+
diff --git a/debian/tests/run-unit-test b/debian/tests/run-unit-test
new file mode 100644
index 0000000..99d8710
--- /dev/null
+++ b/debian/tests/run-unit-test
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+
+pkg=tcode
+CUR_DIR=`pwd`
+
+export LC_ALL=C.UTF-8
+if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
+ AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
+ trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
+fi
+
+cp /usr/share/doc/${pkg}/examples/* "${AUTOPKGTEST_TMP}"
+cd "${AUTOPKGTEST_TMP}"
+
+# Running texjava
+texjava -savelatex example-texjava.java Complex.java
+
+# Verify that the latex part indeed is saved
+fgrep -q "This class allows one to work with complex numbers of" Complex.java
+
+# Running the code
+javac Complex.java
+java -enableassertions Complex
+
+# Cleanup
+rm -f Complex*
More information about the pkg-java-maintainers
mailing list