// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//
// Author: John Leach
// Contact: john.leach@syger.it

/*
 Tests the Introspector.js code
*/

// Create a short cut to the normal output device
if (!syger.exists(this, "puts")) {
	var puts = function (str) {
		document.write(str);
	};
}

var obj = "string value";
puts(syger.introspect("string variable", obj) + "\n");
if (syger.exists(obj, "indexOf")) {
	puts('string variable.indexOf(" ") returns ' + obj.indexOf(" ") + "\n\n");
} else {
	puts('string variable has no "indexOf" method\n\n');
}

obj = 1.2345;
puts(syger.introspect("numeric variable", obj) + "\n");
if (syger.exists(obj, "toFixed")) {
	puts('numeric variable.toFixed(1) returns ' + obj.toFixed(1) + "\n\n");
} else {
	puts('numeric variable has no "toFixed" method\n\n');
}

obj = { 
	first: 1, 
	second: "2nd", 
	third: function () { return "3rd"; }, 
	fourth: new Object(),
	fifth: null
};
obj.sixth = obj;

puts(syger.introspect("user_defined_object", obj) + "\n");
if (syger.exists(obj, "third")) {
	puts('user_defined_object.third() returns ' + obj.third());
} else {
	puts('user_defined_object has no "third" method');
}
