diff options
Diffstat (limited to 'src/hdb/test.cc')
| -rw-r--r-- | src/hdb/test.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/hdb/test.cc b/src/hdb/test.cc new file mode 100644 index 0000000..b8d335b --- /dev/null +++ b/src/hdb/test.cc | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /************************************************************************* | ||
| 2 | * | ||
| 3 | * HTCd - Copyright (C) 1998-2006 Henrik Rydberg | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <hdb/db.h> | ||
| 21 | |||
| 22 | static fp_stream merr(stderr); | ||
| 23 | |||
| 24 | main(int argc,char* argv[]) throw(merror_t) try | ||
| 25 | { | ||
| 26 | if(argc<2) { | ||
| 27 | merr<<"Usage: "<<argv[0]<<" <path>\n"; | ||
| 28 | return -1; | ||
| 29 | } | ||
| 30 | dbmap m; | ||
| 31 | m.Open(argv[1]); | ||
| 32 | |||
| 33 | merr<<m.head()->filesize.get()<<"\n"; | ||
| 34 | merr<<m.head()->filetop.get()<<"\n"; | ||
| 35 | merr<<m.head()->frame.get()<<"\n"; | ||
| 36 | |||
| 37 | for(int j=0;j<m.Tables();j++) merr<<m.Table(j)<<" "; | ||
| 38 | merr<<"\n\n"; | ||
| 39 | |||
| 40 | for(int i=0;i<m.size();i++) { | ||
| 41 | //for(int j=0;j<m.Tables();j++) merr<<m(i,j)<<" "; | ||
| 42 | for(int j=0;j<1;j++) merr<<m(i,j)<<" "; | ||
| 43 | |||
| 44 | merr<<"\n"; | ||
| 45 | } | ||
| 46 | |||
| 47 | return 0; | ||
| 48 | } | ||
| 49 | catch(const merror_t& e) { | ||
| 50 | merr<<e.desc<<"\n"; | ||
| 51 | return -1; | ||
| 52 | } | ||
