summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-04-04 20:55:44 +0000
committerKarl Berry <karl@freefriends.org>2019-04-04 20:55:44 +0000
commitacab24042d34dd439e1d074820d1da2fa1d591cd (patch)
tree32881f869e20a69711c5fe86134aa48143d9b1e8 /Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex
parent93f5c4643a3d0a596d220ff14756ce68d99afe33 (diff)
pgf (4apr19)
git-svn-id: svn://tug.org/texlive/trunk@50758 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex')
-rw-r--r--Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex266
1 files changed, 133 insertions, 133 deletions
diff --git a/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex b/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex
index ee144598943..225927eb411 100644
--- a/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex
+++ b/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex
@@ -9,8 +9,8 @@
X
\def\SHOW#1{%
- \dimen0=#1 %
- #1 = \the\dimen0
+ \dimen0=#1 %
+ #1 = \the\dimen0
}
\SHOW{1pt}
@@ -40,13 +40,13 @@ X
\newif\ifcomparewithtex
\newif\ifcomparewithfpu
\pgfkeys{
- /ut/compare with TeX/.is if=comparewithtex,
- /ut/compare with TeX=true,
- /ut/compare with fpu/.is if=comparewithfpu,
- /ut/compare with fpu=true,
- /ut/.search also={/pgf/luamath},
- /pgf/luamath/show error message=true,
- /pgf/luamath/enable TeX fallback=false,
+ /ut/compare with TeX/.is if=comparewithtex,
+ /ut/compare with TeX=true,
+ /ut/compare with fpu/.is if=comparewithfpu,
+ /ut/compare with fpu=true,
+ /ut/.search also={/pgf/luamath},
+ /pgf/luamath/show error message=true,
+ /pgf/luamath/enable TeX fallback=false,
}
\newcount\numErrors
@@ -57,113 +57,113 @@ X
% #4: expected 'units declared' (1 or 0)
\def\parsertest{\pgfutil@ifnextchar[\parsertest@{\parsertest@[]}}%
\def\parsertest@[#1]#2#3#4{%
- \begingroup
- \pgfqkeys{/ut}{#1}%
- \pgfluamathparse{#2}%
- \let\actual=\pgfmathresult
- \ifpgfmathunitsdeclared
- \def\actualunitsdeclared{1}%
- \else
- \def\actualunitsdeclared{0}%
- \fi
- %
- \ifcomparewithtex
- \ifpgfluamathusedTeXfallback
- \let\expectedTeX=\actual
- \else
- \pgfmathparse{#2}%
- \let\expectedTeX=\pgfmathresult
- \fi
- \else
- \def\expectedTeX{--}%
- \fi
- %
- \edef\expected{#3}%
- \def\success{1}%
- \ifx\expected\empty
- \ifx\actual\empty
- \else
- \def\success{0}%
- \fi
- \else
- \ifx\actual\expected
- \else
- \def\success{0}%
- \fi
- \fi
- %
- \if1\success
- \else
- \message{FAILURE for #2 expected \expected\space but was \actual^^J}%
- \global\advance\numErrors by1
- \fi
- %
- \if1\success
- \def\expectedunitsdeclared{#4}%
- \ifx\actualunitsdeclared\expectedunitsdeclared
- \else
- \def\success{0}%
- \message{FAILURE for #2 expected units declared #4 but was \actualunitsdeclared^^J}%
- \global\advance\numErrors by1
- \fi
- \fi
- %
- \if1\success
- \ifcomparewithtex
- % check against PGF's basic layer as reference:
- \dimen0=\actual pt %
- \dimen1=\expectedTeX pt %
- \advance\dimen0 by-\dimen1
- \ifdim\dimen0<0sp
- \dimen0=-\dimen0
- \fi
- \ifdim\dimen0 > 0.004pt %
- \def\success{0}%
- \message{FAILURE for #2 : matches expectations, but does NOT match TeX output (error \the\dimen0). expected \expectedTeX\space but was \actual^^J}%
- \global\advance\numErrors by1
- \fi
- %
- %
- \ifpgfmathunitsdeclared
- \def\actualTeXunitsdeclared{1}%
- \else
- \def\actualTeXunitsdeclared{0}%
- \fi
- \ifx\actualTeXunitsdeclared\actualunitsdeclared
- \else
- \message{WARNING for #2 : matches ALL expectations, but TeX's output does NOT match TeX expected units declared (TeX returns \actualTeXunitsdeclared, expectation = LUA is \actualunitsdeclared)^^J}%
- \fi
- \fi
- %
- \ifcomparewithfpu
- % check that FPU works as well. This
- % * tests the FPU
- % * tests that FPU values can be injected into the LUA backend:
- \begingroup
- \pgfkeys{/pgf/fpu,/pgf/fpu/output format=float}%
- \pgfmathparse{#2}%
- \xdef\actualfpu{\pgfmathresult}%
- \ifpgfmathunitsdeclared
- \xdef\actualfpuunitsdeclared{1}%
- \else
- \xdef\actualfpuunitsdeclared{0}%
- \fi
- \endgroup
- %
- \pgfkeys{/pgf/luamath/output format=fixed}%
- \pgfluamathparse{abs(\actual - \actualfpu) > 0.004}%
- \ifdim\pgfmathresult pt=1pt
- \def\success{0}%
- \pgfluamathparse{abs(\actual - \actualfpu)}%
- \message{FAILURE for #2 : matches expectations, but does NOT match output of FPU (error \pgfmathresult). fpu=\actualfpu\space lua=\actual^^J}%
- \global\advance\numErrors by1
- \fi
- \fi
- %
- \fi
- %
- \message{#2 = \actual\space (pgf=\expectedTeX) \if1\success OK\else FAILURE\fi^^J}%
- \endgroup
+ \begingroup
+ \pgfqkeys{/ut}{#1}%
+ \pgfluamathparse{#2}%
+ \let\actual=\pgfmathresult
+ \ifpgfmathunitsdeclared
+ \def\actualunitsdeclared{1}%
+ \else
+ \def\actualunitsdeclared{0}%
+ \fi
+ %
+ \ifcomparewithtex
+ \ifpgfluamathusedTeXfallback
+ \let\expectedTeX=\actual
+ \else
+ \pgfmathparse{#2}%
+ \let\expectedTeX=\pgfmathresult
+ \fi
+ \else
+ \def\expectedTeX{--}%
+ \fi
+ %
+ \edef\expected{#3}%
+ \def\success{1}%
+ \ifx\expected\empty
+ \ifx\actual\empty
+ \else
+ \def\success{0}%
+ \fi
+ \else
+ \ifx\actual\expected
+ \else
+ \def\success{0}%
+ \fi
+ \fi
+ %
+ \if1\success
+ \else
+ \message{FAILURE for #2 expected \expected\space but was \actual^^J}%
+ \global\advance\numErrors by1
+ \fi
+ %
+ \if1\success
+ \def\expectedunitsdeclared{#4}%
+ \ifx\actualunitsdeclared\expectedunitsdeclared
+ \else
+ \def\success{0}%
+ \message{FAILURE for #2 expected units declared #4 but was \actualunitsdeclared^^J}%
+ \global\advance\numErrors by1
+ \fi
+ \fi
+ %
+ \if1\success
+ \ifcomparewithtex
+ % check against PGF's basic layer as reference:
+ \dimen0=\actual pt %
+ \dimen1=\expectedTeX pt %
+ \advance\dimen0 by-\dimen1
+ \ifdim\dimen0<0sp
+ \dimen0=-\dimen0
+ \fi
+ \ifdim\dimen0 > 0.004pt %
+ \def\success{0}%
+ \message{FAILURE for #2 : matches expectations, but does NOT match TeX output (error \the\dimen0). expected \expectedTeX\space but was \actual^^J}%
+ \global\advance\numErrors by1
+ \fi
+ %
+ %
+ \ifpgfmathunitsdeclared
+ \def\actualTeXunitsdeclared{1}%
+ \else
+ \def\actualTeXunitsdeclared{0}%
+ \fi
+ \ifx\actualTeXunitsdeclared\actualunitsdeclared
+ \else
+ \message{WARNING for #2 : matches ALL expectations, but TeX's output does NOT match TeX expected units declared (TeX returns \actualTeXunitsdeclared, expectation = LUA is \actualunitsdeclared)^^J}%
+ \fi
+ \fi
+ %
+ \ifcomparewithfpu
+ % check that FPU works as well. This
+ % * tests the FPU
+ % * tests that FPU values can be injected into the LUA backend:
+ \begingroup
+ \pgfkeys{/pgf/fpu,/pgf/fpu/output format=float}%
+ \pgfmathparse{#2}%
+ \xdef\actualfpu{\pgfmathresult}%
+ \ifpgfmathunitsdeclared
+ \xdef\actualfpuunitsdeclared{1}%
+ \else
+ \xdef\actualfpuunitsdeclared{0}%
+ \fi
+ \endgroup
+ %
+ \pgfkeys{/pgf/luamath/output format=fixed}%
+ \pgfluamathparse{abs(\actual - \actualfpu) > 0.004}%
+ \ifdim\pgfmathresult pt=1pt
+ \def\success{0}%
+ \pgfluamathparse{abs(\actual - \actualfpu)}%
+ \message{FAILURE for #2 : matches expectations, but does NOT match output of FPU (error \pgfmathresult). fpu=\actualfpu\space lua=\actual^^J}%
+ \global\advance\numErrors by1
+ \fi
+ \fi
+ %
+ \fi
+ %
+ \message{#2 = \actual\space (pgf=\expectedTeX) \if1\success OK\else FAILURE\fi^^J}%
+ \endgroup
}%
\parsertest{1}{1.0}{0}
@@ -225,10 +225,10 @@ X
\pgfmathdeclarefunction{N1}{3}{\pgfmathparse{#1+#2+#3}}%
\directlua{
function pgfluamathfunctions.x()
- return 4
+ return 4
end
function pgfluamathfunctions.N1(x,m,n)
- return x+m+n
+ return x+m+n
end
}
\parsertest{2^x}{16.0}{0}
@@ -371,8 +371,8 @@ end
\parsertest{0 <0.1 || 4 <0.1}{1.0}{0}
{
\pgfkeys{/pgf/declare function={
- xx=4;
- yy=4;
+ xx=4;
+ yy=4;
}}
\parsertest{abs(xx-yy)<0.1 ? -42 : 42}{-42.0}{0}
\parsertest{abs(xx-yy)<0.1 || abs(xx-0.5)<0.1}{1.0}{0}
@@ -425,11 +425,11 @@ end
% -- strings with "<str>"
% -- 'scalar' function
% -- hex/octal/binary input
-% -- tex registers
+% -- tex registers
% -- What happens for undefined functions!? --> return nil and let TeX invoke its parser (no warning!?)
% -- width/height/depth
% end
-%--------------------------------------------------
+%--------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -510,15 +510,15 @@ end
% should have been clean up:
\parsertest[show error message=false,compare with TeX=false,compare with fpu=false]{mu1(-5,2)}{}{0}
-
+
\def\pgfmathifexpressionTest#1{%
- \pgfmathifexpression{1000>999}{%
- % ok
- \message{PASSED for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}%
- }{%
- \message{FAILURE for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}%
- \global\advance\numErrors by1
- }%
+ \pgfmathifexpression{1000>999}{%
+ % ok
+ \message{PASSED for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}%
+ }{%
+ \message{FAILURE for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}%
+ \global\advance\numErrors by1
+ }%
}
\pgfmathifexpressionTest{basicmath}
@@ -533,7 +533,7 @@ end
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
\pgfmathifexpressionTest{fpu output fixed}
\endgroup
-
+
\begingroup
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=sci}%
\pgfmathifexpressionTest{fpu output sci}
@@ -553,9 +553,9 @@ end
% NO MORE TEST CASES HERE!
\ifnum\numErrors>0
- \PackageError{pgf}{Has \the\numErrors\space FAILURES}{}
+ \PackageError{pgf}{Has \the\numErrors\space FAILURES}{}
\else
- \message{All cases PASSED^^J}%
+ \message{All cases PASSED^^J}%
\fi