\input regression-test.tex
\documentclass{article}
\usepackage{tikzphysics}
\newdimen\actual
\newdimen\error
\newcommand{\assertcoord}[5]{%
 \pgfextractx{\actual}{\pgfpointanchor{#1}{#2}}\error=\actual\advance\error by-#3\relax
 \ifdim\error<0pt\error=-\error\fi
 \ifdim\error<.04pt\TYPE{PASS: #5 x}\else\TYPE{FAIL: #5 x got \the\actual}\fi
 \pgfextracty{\actual}{\pgfpointanchor{#1}{#2}}\error=\actual\advance\error by-#4\relax
 \ifdim\error<0pt\error=-\error\fi
 \ifdim\error<.04pt\TYPE{PASS: #5 y}\else\TYPE{FAIL: #5 y got \the\actual}\fi}

\newdimen\expectedx
\newdimen\expectedy
\newcommand{\sameanchor}[4]{%
 \pgfextractx{\expectedx}{\pgfpointanchor{#1}{#3}}%
 \pgfextracty{\expectedy}{\pgfpointanchor{#1}{#3}}%
 \assertcoord{#1}{#2}{\expectedx}{\expectedy}{#4}}
\begin{document}\START\setbox0=\hbox{\begin{tikzpicture}
\node[plane-mirror] (N0) {};
\node[plano-convex-lens] (N1) {};
\node[plano-concave-lens] (N2) {};
\node[positive-meniscus-lens] (N3) {};
\node[negative-meniscus-lens] (N4) {};
\sameanchor{N0}{front-0}{front-bottom}{variant 0 front 0}
\sameanchor{N0}{front-50}{front-mid}{variant 0 front 50}
\sameanchor{N0}{front-100}{front-top}{variant 0 front 100}
\sameanchor{N0}{back-0}{back-bottom}{variant 0 back 0}
\sameanchor{N0}{back-50}{back-mid}{variant 0 back 50}
\sameanchor{N0}{back-100}{back-top}{variant 0 back 100}
\sameanchor{N0}{surface-0}{0}{variant 0 shorthand 0}
\sameanchor{N0}{surface-17}{17}{variant 0 shorthand 17}
\sameanchor{N0}{surface-50}{50}{variant 0 shorthand 50}
\sameanchor{N0}{surface-83}{83}{variant 0 shorthand 83}
\sameanchor{N0}{surface-100}{100}{variant 0 shorthand 100}
\sameanchor{N0}{top-50}{top}{variant 0 top midpoint}
\sameanchor{N0}{bottom-50}{bottom}{variant 0 bottom midpoint}
\sameanchor{N1}{front-0}{front-bottom}{variant 1 front 0}
\sameanchor{N1}{front-50}{front-mid}{variant 1 front 50}
\sameanchor{N1}{front-100}{front-top}{variant 1 front 100}
\sameanchor{N1}{back-0}{back-bottom}{variant 1 back 0}
\sameanchor{N1}{back-50}{back-mid}{variant 1 back 50}
\sameanchor{N1}{back-100}{back-top}{variant 1 back 100}
\sameanchor{N1}{surface-0}{0}{variant 1 shorthand 0}
\sameanchor{N1}{surface-17}{17}{variant 1 shorthand 17}
\sameanchor{N1}{surface-50}{50}{variant 1 shorthand 50}
\sameanchor{N1}{surface-83}{83}{variant 1 shorthand 83}
\sameanchor{N1}{surface-100}{100}{variant 1 shorthand 100}
\sameanchor{N1}{top-50}{top}{variant 1 top midpoint}
\sameanchor{N1}{bottom-50}{bottom}{variant 1 bottom midpoint}
\sameanchor{N2}{front-0}{front-bottom}{variant 2 front 0}
\sameanchor{N2}{front-50}{front-mid}{variant 2 front 50}
\sameanchor{N2}{front-100}{front-top}{variant 2 front 100}
\sameanchor{N2}{back-0}{back-bottom}{variant 2 back 0}
\sameanchor{N2}{back-50}{back-mid}{variant 2 back 50}
\sameanchor{N2}{back-100}{back-top}{variant 2 back 100}
\sameanchor{N2}{surface-0}{0}{variant 2 shorthand 0}
\sameanchor{N2}{surface-17}{17}{variant 2 shorthand 17}
\sameanchor{N2}{surface-50}{50}{variant 2 shorthand 50}
\sameanchor{N2}{surface-83}{83}{variant 2 shorthand 83}
\sameanchor{N2}{surface-100}{100}{variant 2 shorthand 100}
\sameanchor{N2}{top-50}{top}{variant 2 top midpoint}
\sameanchor{N2}{bottom-50}{bottom}{variant 2 bottom midpoint}
\sameanchor{N3}{front-0}{front-bottom}{variant 3 front 0}
\sameanchor{N3}{front-50}{front-mid}{variant 3 front 50}
\sameanchor{N3}{front-100}{front-top}{variant 3 front 100}
\sameanchor{N3}{back-0}{back-bottom}{variant 3 back 0}
\sameanchor{N3}{back-50}{back-mid}{variant 3 back 50}
\sameanchor{N3}{back-100}{back-top}{variant 3 back 100}
\sameanchor{N3}{surface-0}{0}{variant 3 shorthand 0}
\sameanchor{N3}{surface-17}{17}{variant 3 shorthand 17}
\sameanchor{N3}{surface-50}{50}{variant 3 shorthand 50}
\sameanchor{N3}{surface-83}{83}{variant 3 shorthand 83}
\sameanchor{N3}{surface-100}{100}{variant 3 shorthand 100}
\sameanchor{N3}{top-50}{top}{variant 3 top midpoint}
\sameanchor{N3}{bottom-50}{bottom}{variant 3 bottom midpoint}
\sameanchor{N4}{front-0}{front-bottom}{variant 4 front 0}
\sameanchor{N4}{front-50}{front-mid}{variant 4 front 50}
\sameanchor{N4}{front-100}{front-top}{variant 4 front 100}
\sameanchor{N4}{back-0}{back-bottom}{variant 4 back 0}
\sameanchor{N4}{back-50}{back-mid}{variant 4 back 50}
\sameanchor{N4}{back-100}{back-top}{variant 4 back 100}
\sameanchor{N4}{surface-0}{0}{variant 4 shorthand 0}
\sameanchor{N4}{surface-17}{17}{variant 4 shorthand 17}
\sameanchor{N4}{surface-50}{50}{variant 4 shorthand 50}
\sameanchor{N4}{surface-83}{83}{variant 4 shorthand 83}
\sameanchor{N4}{surface-100}{100}{variant 4 shorthand 100}
\sameanchor{N4}{top-50}{top}{variant 4 top midpoint}
\sameanchor{N4}{bottom-50}{bottom}{variant 4 bottom midpoint}

\assertcoord{N0}{surface-25}{-.125cm}{-.75cm}{plane quarter}
\assertcoord{N0}{top-25}{.0625cm}{1.5cm}{plane top quarter}
\assertcoord{N1}{back-50}{.21515cm}{0cm}{plano convex centre}
\assertcoord{N2}{front-25}{-.1cm}{-.75cm}{plano concave flat face}
\assertcoord{N2}{back-100}{.3303cm}{1.5cm}{plano concave curved edge}
\node[plane-mirror,rotate=90,scale=2,mirror height=4cm,mirror thickness=.4cm] (R) at (3,0) {};
\assertcoord{R}{surface-25}{5cm}{-.4cm}{transformed plane quarter}
\assertcoord{N0}{surface-25}{-.125cm}{-.75cm}{earlier plane geometry preserved}
\node[plano-convex-lens,lens height=2cm,lens radius=3cm,show anchors,
 physics debug/anchor families={surface,top,bottom},physics debug/anchor samples={0,50,100}] (Debug) {};
\TYPE{PASS: new variant debug families render}
\node[plane-mirror,mirror height=12cm] (Tall) {};
\assertcoord{Tall}{surface-100}{-.125cm}{6cm}{flat mirror ignores radius}
\makeatletter
\foreach \family in {surface,front,back,top,bottom}{
 \foreach \t in {0,...,100}{
  \ifcsname pgf@anchor@physicsvariantlens@\family-\t\endcsname
  \else\TYPE{FAIL: missing \family-\t}\fi}}
\makeatother
\TYPE{PASS: all five integer families declared}
\end{tikzpicture}}\END\end{document}
