2 Copyright (C) 1994-2007 Frans Slothouber, Jacco van Weert, Petteri Kettunen,
3 Bernd Koesling, Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner,
4 Sasha Vasko, Kai Hofmann, Thierry Pierron, Friedrich Haase, and Gergely Budai.
6 This file is part of ROBODoc
8 ROBODoc is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 #include "directory.h"
33 #include "generator.h"
37 int test_directory( );
41 The output of this programmed if diffed with a reference
42 file to see if robodoc still does what is supposed to do.
46 main( int argc, char **argv )
48 course_of_action = course_of_action | DO_TELL;
50 printf( "robodoc unittest\n" );
59 Test struct RB_Document and it's functions.
64 struct RB_Document *document = NULL;
65 struct RB_Filename *rbfilename = NULL;
66 struct RB_Path *rbpath = NULL;
67 struct RB_Part *rbpart = NULL;
69 /* Try creating and deleting and empty document */ .
70 document = RB_Get_RB_Document( );
72 RB_Free_RB_Document( document );
75 /* Now we fill it with some stuff. */
76 document = RB_Get_RB_Document( );
78 rbpath = RB_Get_RB_Path( "/home/robodoc/test2/" );
79 rbfilename = RB_Get_RB_Filename( "robodoc.c", rbpath );
81 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rbfilename ) );
82 printf( "Path [ %s ]\n", RB_Get_Path( rbfilename ) );
83 printf( "Extension [ %s ]\n", RB_Get_Extension( rbfilename ) );
85 rbpart = RB_Get_RB_Part( );
86 RB_Part_Add_Source( rbpart, rbfilename );
88 rbfilename = RB_Get_RB_Filename( "analyser.c", rbpath );
89 RB_Part_Add_Source( rbpart, rbfilename );
91 RB_Part_Dump( rbpart );
93 RB_Document_Add_Part( document, rbpart );
95 RB_Analyse_Document_NG( document );
97 RB_Generate_Documentation_NG( document );
99 RB_Free_RB_Document( document );
107 struct RB_Directory *rb_directory = NULL;
109 printf( "test_directory\n" );
111 rb_directory = RB_Get_RB_Directory( "/home/robodoc/test2/" );
112 assert( rb_directory );
113 RB_Dump_RB_Directory( rb_directory );
114 RB_Free_RB_Directory( rb_directory );
119 /* Test path and file functions. */
124 struct RB_Path *rb_path1 = NULL;
125 struct RB_Filename *rb_filename1 = NULL;
127 printf( "test_file\n" );
128 rb_path1 = RB_Get_RB_Path( "/home/robodoc/test2/" );
129 rb_filename1 = RB_Get_RB_Filename( "test.c", rb_path1 );
130 assert( rb_filename1 );
131 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rb_filename1 ) );
132 printf( "Path [ %s ]\n", RB_Get_Path( rb_filename1 ) );
133 printf( "Extension [ %s ]\n", RB_Get_Extension( rb_filename1 ) );
135 RB_Free_RB_Filename( rb_filename1 );
137 rb_path1 = RB_Get_RB_Path( "/home/robodoc/test2/" );
139 rb_filename1 = RB_Get_RB_Filename( "Makefile", rb_path1 );
140 assert( rb_filename1 );
141 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rb_filename1 ) );
142 printf( "Path [ %s ]\n", RB_Get_Path( rb_filename1 ) );
143 printf( "Extension [ %s ]\n", RB_Get_Extension( rb_filename1 ) );
145 RB_Free_RB_Filename( rb_filename1 );
147 rb_path1 = RB_Get_RB_Path( "./" );
149 rb_filename1 = RB_Get_RB_Filename( "test.cpp", rb_path1 );
150 assert( rb_filename1 );
151 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rb_filename1 ) );
152 printf( "Path [ %s ]\n", RB_Get_Path( rb_filename1 ) );
153 printf( "Extension [ %s ]\n", RB_Get_Extension( rb_filename1 ) );
155 RB_Free_RB_Filename( rb_filename1 );
157 rb_path1 = RB_Get_RB_Path( "./" );
159 rb_filename1 = RB_Get_RB_Filename( ".testrc", rb_path1 );
160 assert( rb_filename1 );
161 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rb_filename1 ) );
162 printf( "Path [ %s ]\n", RB_Get_Path( rb_filename1 ) );
163 printf( "Extension [ %s ]\n", RB_Get_Extension( rb_filename1 ) );
165 RB_Free_RB_Filename( rb_filename1 );
167 /* Try something with a lot of dots */
168 rb_path1 = RB_Get_RB_Path( "./../../" );
170 rb_filename1 = RB_Get_RB_Filename( "file.c.doc", rb_path1 );
171 assert( rb_filename1 );
172 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rb_filename1 ) );
173 printf( "Path [ %s ]\n", RB_Get_Path( rb_filename1 ) );
174 printf( "Extension [ %s ]\n", RB_Get_Extension( rb_filename1 ) );
176 RB_Free_RB_Filename( rb_filename1 );
178 /* Lets see if a slash gets added if we don't
179 specify the end slash in a path name. */
180 rb_path1 = RB_Get_RB_Path( "/home/robodoc/test2" );
182 rb_filename1 = RB_Get_RB_Filename( "Makefile", rb_path1 );
183 assert( rb_filename1 );
184 printf( "Fullname [ %s ]\n", RB_Get_Fullname( rb_filename1 ) );
185 printf( "Path [ %s ]\n", RB_Get_Path( rb_filename1 ) );
186 printf( "Extension [ %s ]\n", RB_Get_Extension( rb_filename1 ) );
188 RB_Free_RB_Filename( rb_filename1 );