//============================================================================== // // Copyright (C) 2002 Dick van Oudheusden // // This program 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 2 of the License, or (at your option) any later version. // // This program 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 this program; if not, write to the Free // Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // //============================================================================== // // $Date: 2003/10/31 08:12:34 $ $Revision: 1.1 $ // //============================================================================== #include #include "ofc/config.h" #include "ofc/DDouble.h" #include "DInc.h" #include "DTest.h" //-DataTypes------------------------------------------------------------------- void DDouble_test() { DDouble *d = [[DDouble alloc] init]; DDouble *c = [[DDouble alloc] init]; char t[] = "12.6+"; char w[] = "^12.5"; char *pt; STARTTEST(); TEST([d get] == 0.0); TEST([[d set :7.0] get] == 7.0); TEST([[d toText] ccompare :"7"] == 0); [c set :-4.0]; TEST([d compare :c] == 1); TEST([c compare :d] == -1); pt = t; TEST([c fromString :&pt] == 0); TEST([c get] == 12.6); TEST(*pt == '+'); pt = w; TEST([c fromString :&pt] == ENODATA); STOPTEST(); }