\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[beam] (N0) {};
\node[damper] (N1) {};
\node[compound pulley] (N2) {};
\node[physical pendulum] (N3) {};
\node[piston cylinder] (N4) {};
\node[capillary tube] (N5) {};
\node[nozzle] (N6) {};
\node[venturi] (N7) {};
\node[layered tank] (N8) {};
\node[solid cylinder] (N9) {};
\node[solid cone] (N10) {};
\node[solid frustum] (N11) {};
\node[cylindrical shell] (N12) {};
\node[conical shell] (N13) {};
\node[hemisphere] (N14) {};
\node[track] (N15) {};
\node[circular bowl] (N16) {};
\node[loop track] (N17) {};
\node[transverse wave] (N18) {};
\node[standing wave] (N19) {};
\node[longitudinal wave] (N20) {};
\node[open pipe] (N21) {};
\node[closed pipe] (N22) {};
\assertcoord{N0}{top-25}{0.750000cm}{0.125000cm}{beam top-25}
\assertcoord{N0}{axis-75}{0.750000cm}{0.000000cm}{beam axis-75}
\assertcoord{N1}{piston-25}{0.000000cm}{-0.140000cm}{damper piston-25}
\assertcoord{N1}{start}{-1.500000cm}{0.000000cm}{damper start}
\assertcoord{N2}{rim-25}{0.000000cm}{1.000000cm}{compound pulley rim-25}
\assertcoord{N2}{inner-rim-50}{-0.550000cm}{0.000000cm}{compound pulley inner-rim-50}
\assertcoord{N3}{pivot}{0.000000cm}{1.200000cm}{physical pendulum pivot}
\assertcoord{N3}{axis-25}{0.000000cm}{0.750000cm}{physical pendulum axis-25}
\assertcoord{N4}{piston-25}{-0.450000cm}{0.450000cm}{piston cylinder piston-25}
\assertcoord{N5}{surface-50}{0.000000cm}{0.180000cm}{capillary tube surface-50}
\assertcoord{N5}{surface-0}{-0.250000cm}{0.300000cm}{capillary tube surface-0}
\assertcoord{N6}{top-25}{-1.000000cm}{0.637760cm}{nozzle top-25}
\assertcoord{N6}{outlet-50}{2.000000cm}{0.000000cm}{nozzle outlet-50}
\assertcoord{N7}{top-50}{0.000000cm}{0.275000cm}{venturi top-50}
\assertcoord{N7}{top-25}{-1.000000cm}{0.487500cm}{venturi top-25}
\assertcoord{N8}{interface-25}{-0.750000cm}{-0.375000cm}{layered tank interface-25}
\assertcoord{N8}{surface-50}{0.000000cm}{0.625000cm}{layered tank surface-50}
\assertcoord{N9}{bottom-rim-25}{0.000000cm}{-1.000000cm}{solid cylinder bottom-rim-25}
\assertcoord{N9}{generator-50}{1.000000cm}{0.000000cm}{solid cylinder generator-50}
\assertcoord{N10}{top-rim-25}{0.000000cm}{1.250000cm}{solid cone top-rim-25}
\assertcoord{N10}{generator-50}{0.500000cm}{0.000000cm}{solid cone generator-50}
\assertcoord{N11}{generator-50}{0.750000cm}{0.000000cm}{solid frustum generator-50}
\assertcoord{N12}{inner-top-rim-50}{-0.800000cm}{1.250000cm}{cylindrical shell inner-top-rim-50}
\assertcoord{N13}{inner-top-rim-50}{-0.400000cm}{1.250000cm}{conical shell inner-top-rim-50}
\assertcoord{N14}{rim-25}{0.000000cm}{0.300000cm}{hemisphere rim-25}
\assertcoord{N14}{meridian-50}{0.000000cm}{1.200000cm}{hemisphere meridian-50}
\assertcoord{N15}{surface-25}{-0.916667cm}{-0.500000cm}{track surface-25}
\assertcoord{N15}{surface-50}{0.000000cm}{0.000000cm}{track surface-50}
\assertcoord{N15}{normal-50}{-0.120000cm}{0.160000cm}{track normal-50}
\assertcoord{N15}{tangent-after-50}{0.160000cm}{0.120000cm}{track tangent-after-50}
\assertcoord{N16}{surface-25}{-0.989949cm}{-0.989949cm}{circular bowl surface-25}
\assertcoord{N16}{normal-50}{0.000000cm}{-1.200000cm}{circular bowl normal-50}
\assertcoord{N17}{surface-25}{1.400000cm}{0.000000cm}{loop track surface-25}
\assertcoord{N17}{normal-25}{1.200000cm}{0.000000cm}{loop track normal-25}
\assertcoord{N18}{curve-12}{-1.520000cm}{0.399211cm}{transverse wave curve-12}
\assertcoord{N19}{node-1}{-0.666667cm}{0.000000cm}{standing wave node-1}
\assertcoord{N19}{antinode-0}{-1.333333cm}{0.000000cm}{standing wave antinode-0}
\assertcoord{N19}{curve-50}{0.000000cm}{-0.400000cm}{standing wave curve-50}
\assertcoord{N20}{curve-10}{-1.403225cm}{-0.235114cm}{longitudinal wave curve-10}
\assertcoord{N21}{node-0}{0.000000cm}{0.000000cm}{open pipe node-0}
\assertcoord{N21}{antinode-1}{2.000000cm}{0.000000cm}{open pipe antinode-1}
\assertcoord{N21}{curve-0}{-2.000000cm}{0.280000cm}{open pipe curve-0}
\assertcoord{N22}{node-0}{-2.000000cm}{0.000000cm}{closed pipe node-0}
\assertcoord{N22}{antinode-0}{2.000000cm}{0.000000cm}{closed pipe antinode-0}
\assertcoord{N22}{curve-100}{2.000000cm}{0.280000cm}{closed pipe curve-100}

\node[beam,beam length=40mm,beam thickness=2mm,rotate=90,scale=2] (B) at (3,0) {};
\assertcoord{B}{axis-25}{3cm}{-2cm}{rotated scaled beam}
\node[capillary tube,capillary sag=-.1,capillary width=1,capillary height=4,capillary level=.5] (C) {};
\assertcoord{C}{surface-50}{0cm}{.1cm}{convex capillary custom bare lengths}
\node[closed pipe,pipe mode=2] (P) {};
\assertcoord{P}{node-1}{.666667cm}{0cm}{third harmonic internal node}
\assertcoord{P}{curve-50}{0cm}{.197990cm}{third harmonic displacement}
\node[transverse wave,wave phase=90,wave cycles=1] (W) {};
\assertcoord{W}{curve-0}{-2cm}{.4cm}{wave phase shift}
\assertcoord{N18}{curve-0}{-2cm}{0cm}{earlier wave state remains local}
\node[track,track rough start=20,track rough end=80] (T) {};
\node[track,anchor=start] (Next) at (T.end) {};
\pgfextractx{\expectedx}{\pgfpointanchor{T}{end}}
\pgfextracty{\expectedy}{\pgfpointanchor{T}{end}}
\assertcoord{Next}{start}{\expectedx}{\expectedy}{joined track endpoints}
\draw[rod] (-1,-1)--(1,-1);
\node[rod node] (Rod) {};
\assertcoord{Rod}{end}{1.5cm}{0cm}{rod path and node compatibility}
\node[physical pendulum,anchor=pivot,rotate=30] (Pend) at (2,3) {};
\assertcoord{Pend}{pivot}{2cm}{3cm}{suspended rigid pendulum pivot}
\node[beam,show anchors,show keys,physics debug/anchor families={axis,top},physics debug/anchor samples={0,50,100}] (Debug) {};
\TYPE{PASS: component debug overlays render}
\end{tikzpicture}}
\makeatletter
\foreach \family in {bottom,right,top,left,axis}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsbeamnode@\family-\t\endcsname\else\TYPE{FAIL: missing beam \family-\t}\fi
}}
\TYPE{PASS: beam complete percentage families}
\foreach \family in {axis,piston,top,bottom}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsdampernode@\family-\t\endcsname\else\TYPE{FAIL: missing damper \family-\t}\fi
}}
\TYPE{PASS: damper complete percentage families}
\foreach \family in {rim,inner-rim}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicscompoundpulleynode@\family-\t\endcsname\else\TYPE{FAIL: missing compound pulley \family-\t}\fi
}}
\TYPE{PASS: compound pulley complete percentage families}
\foreach \family in {bottom,right,top,left,axis}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsphysicalpendulumnode@\family-\t\endcsname\else\TYPE{FAIL: missing physical pendulum \family-\t}\fi
}}
\TYPE{PASS: physical pendulum complete percentage families}
\foreach \family in {bottom,right,top,left,piston,axis,wall-left,wall-right}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicspistoncylindernode@\family-\t\endcsname\else\TYPE{FAIL: missing piston cylinder \family-\t}\fi
}}
\TYPE{PASS: piston cylinder complete percentage families}
\foreach \family in {surface,wall-left,wall-right,axis}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicscapillarytubenode@\family-\t\endcsname\else\TYPE{FAIL: missing capillary tube \family-\t}\fi
}}
\TYPE{PASS: capillary tube complete percentage families}
\foreach \family in {axis,top,bottom,inlet,outlet,throat}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsnozzlenode@\family-\t\endcsname\else\TYPE{FAIL: missing nozzle \family-\t}\fi
}}
\TYPE{PASS: nozzle complete percentage families}
\foreach \family in {axis,top,bottom,inlet,outlet,throat}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsventurinode@\family-\t\endcsname\else\TYPE{FAIL: missing venturi \family-\t}\fi
}}
\TYPE{PASS: venturi complete percentage families}
\foreach \family in {bottom,right,top,left,interface,surface}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicslayeredtanknode@\family-\t\endcsname\else\TYPE{FAIL: missing layered tank \family-\t}\fi
}}
\TYPE{PASS: layered tank complete percentage families}
\foreach \family in {axis,bottom-rim,top-rim,generator}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicssolidcylindernode@\family-\t\endcsname\else\TYPE{FAIL: missing solid cylinder \family-\t}\fi
}}
\TYPE{PASS: solid cylinder complete percentage families}
\foreach \family in {axis,bottom-rim,top-rim,generator}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicssolidconenode@\family-\t\endcsname\else\TYPE{FAIL: missing solid cone \family-\t}\fi
}}
\TYPE{PASS: solid cone complete percentage families}
\foreach \family in {axis,bottom-rim,top-rim,generator}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicssolidfrustumnode@\family-\t\endcsname\else\TYPE{FAIL: missing solid frustum \family-\t}\fi
}}
\TYPE{PASS: solid frustum complete percentage families}
\foreach \family in {axis,bottom-rim,top-rim,generator,inner-bottom-rim,inner-top-rim}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicscylindricalshellnode@\family-\t\endcsname\else\TYPE{FAIL: missing cylindrical shell \family-\t}\fi
}}
\TYPE{PASS: cylindrical shell complete percentage families}
\foreach \family in {axis,bottom-rim,top-rim,generator,inner-bottom-rim,inner-top-rim}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsconicalshellnode@\family-\t\endcsname\else\TYPE{FAIL: missing conical shell \family-\t}\fi
}}
\TYPE{PASS: conical shell complete percentage families}
\foreach \family in {rim,meridian,axis}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicshemispherenode@\family-\t\endcsname\else\TYPE{FAIL: missing hemisphere \family-\t}\fi
}}
\TYPE{PASS: hemisphere complete percentage families}
\foreach \family in {surface,tangent-before,tangent-after,normal}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicstracknode@\family-\t\endcsname\else\TYPE{FAIL: missing track \family-\t}\fi
}}
\TYPE{PASS: track complete percentage families}
\foreach \family in {surface,tangent-before,tangent-after,normal}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicscircularbowlnode@\family-\t\endcsname\else\TYPE{FAIL: missing circular bowl \family-\t}\fi
}}
\TYPE{PASS: circular bowl complete percentage families}
\foreach \family in {surface,tangent-before,tangent-after,normal}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicslooptracknode@\family-\t\endcsname\else\TYPE{FAIL: missing loop track \family-\t}\fi
}}
\TYPE{PASS: loop track complete percentage families}
\foreach \family in {axis,curve}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicstransversewavenode@\family-\t\endcsname\else\TYPE{FAIL: missing transverse wave \family-\t}\fi
}}
\TYPE{PASS: transverse wave complete percentage families}
\foreach \family in {axis,curve}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsstandingwavenode@\family-\t\endcsname\else\TYPE{FAIL: missing standing wave \family-\t}\fi
}}
\TYPE{PASS: standing wave complete percentage families}
\foreach \family in {axis,curve}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicslongitudinalwavenode@\family-\t\endcsname\else\TYPE{FAIL: missing longitudinal wave \family-\t}\fi
}}
\TYPE{PASS: longitudinal wave complete percentage families}
\foreach \family in {axis,curve,top,bottom}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsopenpipenode@\family-\t\endcsname\else\TYPE{FAIL: missing open pipe \family-\t}\fi
}}
\TYPE{PASS: open pipe complete percentage families}
\foreach \family in {axis,curve,top,bottom}{\foreach \t in {0,...,100}{
\ifcsname pgf@anchor@physicsclosedpipenode@\family-\t\endcsname\else\TYPE{FAIL: missing closed pipe \family-\t}\fi
}}
\TYPE{PASS: closed pipe complete percentage families}
\makeatother\END\end{document}