mtxtest.cc

Go to the documentation of this file.
00001 
00003 
00004 //
00005 // Copyright (c) 2005-2007 University of Southern California
00006 // Rob Peters <rjpeters at usc dot edu>
00007 //
00008 // created: Wed Feb 23 10:32:07 2005
00009 // commit: $Id: mtxtest.cc 10065 2007-04-12 05:54:56Z rjpeters $
00010 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/pkgs/whitebox/mtxtest.cc $
00011 //
00012 // --------------------------------------------------------------------
00013 //
00014 // This file is part of GroovX.
00015 //   [http://ilab.usc.edu/rjpeters/groovx/]
00016 //
00017 // GroovX is free software; you can redistribute it and/or modify it
00018 // under the terms of the GNU General Public License as published by
00019 // the Free Software Foundation; either version 2 of the License, or
00020 // (at your option) any later version.
00021 //
00022 // GroovX is distributed in the hope that it will be useful, but
00023 // WITHOUT ANY WARRANTY; without even the implied warranty of
00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025 // General Public License for more details.
00026 //
00027 // You should have received a copy of the GNU General Public License
00028 // along with GroovX; if not, write to the Free Software Foundation,
00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00030 //
00032 
00033 #ifndef GROOVX_PKGS_WHITEBOX_MTXTEST_CC_UTC20050626084022_DEFINED
00034 #define GROOVX_PKGS_WHITEBOX_MTXTEST_CC_UTC20050626084022_DEFINED
00035 
00036 #include "pkgs/whitebox/mtxtest.h"
00037 
00038 #include "mtx/mtx.h"
00039 #include "mtx/mtxops.h"
00040 
00041 #include "tcl/pkg.h"
00042 
00043 #include "rutz/unittest.h"
00044 
00045 #include "rutz/trace.h"
00046 
00047 namespace
00048 {
00049   void testPrint()
00050   {
00051     for (int i = 1; i <= 10; ++i)
00052       {
00053         const mtx m1 = rand_mtx(i, i);
00054 
00055         const rutz::fstring s = m1.as_string();
00056 
00057         const mtx m2 = mtx::from_string(s.c_str());
00058 
00059         TEST_REQUIRE_APPROX(fabs((m2-m1).max()), 0.0, 1e-40);
00060       }
00061   }
00062 }
00063 
00064 extern "C"
00065 int Mtxtest_Init(Tcl_Interp* interp)
00066 {
00067 GVX_TRACE("Mtxtest_Init");
00068 
00069   GVX_PKG_CREATE(pkg, interp, "Mtxtest", "4.$Revision: 10065 $");
00070 
00071   DEF_TEST(pkg, testPrint);
00072 
00073   GVX_PKG_RETURN(pkg);
00074 }
00075 
00076 // Need these to avoid dyld errors on Mac OS X
00077 extern "C" int Mtxtest_SafeInit(Tcl_Interp*) { return 1; }
00078 
00079 extern "C" int Mtxtest_Unload(Tcl_Interp* interp, int /*flags*/)
00080 {
00081 GVX_TRACE("Mtxtest_Unload");
00082   return tcl::pkg::destroy_on_unload(interp, "Mtxtest");
00083 }
00084 
00085 extern "C" int Mtxtest_SafeUnload(Tcl_Interp*, int /*flags*/) { return 1; }
00086 
00087 static const char __attribute__((used)) vcid_groovx_pkgs_whitebox_mtxtest_cc_utc20050626084022[] = "$Id: mtxtest.cc 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00088 #endif // !GROOVX_PKGS_WHITEBOX_MTXTEST_CC_UTC20050626084022_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:40 2008 by Doxygen version 1.5.5.