\documentclass{article}
% translate with >> pdflatex -shell-escape <file>

% This file is used as unit test for pgfplots, copyright by Christian Feuersaenger.
% 
% See
%   http://pgfplots.sourceforge.net/pgfplots.pdf
% for pgfplots.
%
% Any required input files (for <plot table> or <plot file> or the table package) can be downloaded
% at
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/
% and
% http://www.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/doc/latex/plotdata/

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\pagestyle{empty}

\begin{document}
	% #1: bytes
	% #2: routine
	% #3: numbers
	\long\def\binarytest#1#2#3{%
		\begingroup
		\begingroup
			\escapechar=-1
			\xdef\binarytestname{\string#2}%
		\endgroup
		\section{bytes=#1, \binarytestname}%
		\pgfqkeys{/pgfplots/bin}{bytes=#1}%
		\long\def\binarytestforeach{%
			#2{\num}%
			\num $\mapsto$ \pgfplotsbinaryresult\par
		}%
		\foreach \num in {#3} {%
			\binarytestforeach
		}
		\endgroup
	}%
	\pgfqkeys{/pgfplots/bin}{
%		bytes=4,
%		ASCII85 encoding,
		ASCIIHexEncode,
%		/pgfplots/bin/debug to pdf=\pgfplotsbinaryencodesignedmaplinearly{-16384,-500,-1,0,16,128,129,255,256,1000,65533,65534},
%		/pgfplots/bin/debug to pdf=\pgfplotsbinaryencodeunsigned{0,...,16,128,129,255,256,1000,65533,65534},
	}

	\binarytest4\pgfplotsbinaryencodeunsigned{0,...,16,128,129,255,256,1000,65533,65534}%

	\binarytest2\pgfplotsbinaryencodeunsigned{0,...,16,128,129,255,256,1000,65533,65534}%

	\binarytest1\pgfplotsbinaryencodeunsigned{0,...,16}%

	\binarytest4\pgfplotsbinaryencodesignedmaplinearly{-2147483647,-16384,-500,-1,0,16,128,129,255,256,1000,65533,65534,2147483647}%
	\binarytest3\pgfplotsbinaryencodesignedmaplinearly{-2147483647,-16384,-500,-1,0,16,128,129,255,256,1000,65533,65534,2147483647}%
	\binarytest2\pgfplotsbinaryencodesignedmaplinearly{-2147483647,-16384,-500,-1,0,16,128,129,255,256,1000,65533,65534,2147483647}%


	\binarytest4\pgfplotsbinaryencodedimenmaplinearly{-16383.99999pt,-1pt,0pt,1pt,16383.99999pt}
	\binarytest3\pgfplotsbinaryencodedimenmaplinearly{-16383.99999pt,-1pt,0pt,1pt,16383.99999pt}
	\binarytest2\pgfplotsbinaryencodedimenmaplinearly{-16383.99999pt,-1pt,0pt,1pt,16383.99999pt}
\end{document}
