[216] | 1 | /************************************************************************* |
---|
| 2 | * * |
---|
| 3 | * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * |
---|
| 4 | * All rights reserved. Email: russ@q12.org Web: www.q12.org * |
---|
| 5 | * * |
---|
| 6 | * This library is free software; you can redistribute it and/or * |
---|
| 7 | * modify it under the terms of EITHER: * |
---|
| 8 | * (1) The GNU Lesser General Public License as published by the Free * |
---|
| 9 | * Software Foundation; either version 2.1 of the License, or (at * |
---|
| 10 | * your option) any later version. The text of the GNU Lesser * |
---|
| 11 | * General Public License is included with this library in the * |
---|
| 12 | * file LICENSE.TXT. * |
---|
| 13 | * (2) The BSD-style license that is included with this library in * |
---|
| 14 | * the file LICENSE-BSD.TXT. * |
---|
| 15 | * * |
---|
| 16 | * This library is distributed in the hope that it will be useful, * |
---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * |
---|
| 19 | * LICENSE.TXT and LICENSE-BSD.TXT for more details. * |
---|
| 20 | * * |
---|
| 21 | *************************************************************************/ |
---|
| 22 | |
---|
| 23 | /* stuff used for testing */ |
---|
| 24 | |
---|
| 25 | #ifndef _ODE_TESTING_H_ |
---|
| 26 | #define _ODE_TESTING_H_ |
---|
| 27 | |
---|
| 28 | #include <ode/common.h> |
---|
| 29 | #include "array.h" |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | // compare a sequence of named matrices/vectors, i.e. to make sure that two |
---|
| 33 | // different pieces of code are giving the same results. |
---|
| 34 | |
---|
| 35 | class dMatrixComparison { |
---|
| 36 | struct dMatInfo; |
---|
| 37 | dArray<dMatInfo*> mat; |
---|
| 38 | int afterfirst,index; |
---|
| 39 | |
---|
| 40 | public: |
---|
| 41 | dMatrixComparison(); |
---|
| 42 | ~dMatrixComparison(); |
---|
| 43 | |
---|
| 44 | dReal nextMatrix (dReal *A, int n, int m, int lower_tri, char *name, ...); |
---|
| 45 | // add a new n*m matrix A to the sequence. the name of the matrix is given |
---|
| 46 | // by the printf-style arguments (name,...). if this is the first sequence |
---|
| 47 | // then this object will simply record the matrices and return 0. |
---|
| 48 | // if this the second or subsequent sequence then this object will compare |
---|
| 49 | // the matrices with the first sequence, and report any differences. |
---|
| 50 | // the matrix error will be returned. if `lower_tri' is 1 then only the |
---|
| 51 | // lower triangle of the matrix (including the diagonal) will be compared |
---|
| 52 | // (the matrix must be square). |
---|
| 53 | |
---|
| 54 | void end(); |
---|
| 55 | // end a sequence. |
---|
| 56 | |
---|
| 57 | void reset(); |
---|
| 58 | // restarts the object, so the next sequence will be the first sequence. |
---|
| 59 | |
---|
| 60 | void dump(); |
---|
| 61 | // print out info about all the matrices in the sequence |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | #endif |
---|