(*Copyright (C) 2017, 2018, 2019 Karl Landstrom <karl@miasap.se>

This file is part of OBNC.

OBNC is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

OBNC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with OBNC.  If not, see <http://www.gnu.org/licenses/>.*)

MODULE InTest;

	IMPORT In;

	CONST
		eps = 0.001;

	VAR
		ch: CHAR;
		n: INTEGER;
		x: REAL;
		s: ARRAY 12 OF CHAR;

BEGIN
	In.Char(ch);
	ASSERT(In.Done);
	ASSERT(ch = "a");

	In.Int(n);
	ASSERT(In.Done);
	ASSERT(n = 37);

	In.Int(n);
	ASSERT(In.Done);
	ASSERT(n = 37H);

	In.Real(x);
	ASSERT(In.Done);
	ASSERT(x >= 3.14 - eps);
	ASSERT(x <= 3.14 + eps);

	In.String(s);
	ASSERT(In.Done);
	ASSERT(s = "");

	In.String(s);
	ASSERT(In.Done);
	ASSERT(s = "foo bar");

	In.String(s);
	ASSERT(In.Done);
	ASSERT(s = 0X);

	In.String(s);
	ASSERT(In.Done);
	ASSERT(s = 1FX);

	In.String(s);
	ASSERT(In.Done);
	ASSERT(s = 0FFX);

	In.Name(s);
	ASSERT(In.Done);
	ASSERT(s = "foo/bar");

	In.Line(s);
	ASSERT(In.Done);
	ASSERT(s = "");

	In.Line(s);
	ASSERT(In.Done);
	ASSERT(s = "foo bar")
END InTest.
