/[ascend]/trunk/test/printutil.c
ViewVC logotype

Contents of /trunk/test/printutil.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 956 - (show annotations) (download) (as text)
Sat Dec 9 15:38:05 2006 UTC (13 years, 8 months ago) by johnpye
File MIME type: text/x-csrc
File size: 1956 byte(s)
Removed references to 'ASC_BIG_BUGMAIL' and 'ASC_MILD_BUGMAIL'
Disabled stream redirection functions (they were making testing difficult)
Re-wrote the main test-runner to permit specific tests to be run from the commandline (ongoing)
Disabled readln tests that required stream redirection.
1 /*
2 * Assert implementation override for ASCEND unit tests
3 *
4 * Copyright (C) 2005 Jerry St.Clair
5 *
6 * This file is part of the Ascend Environment.
7 *
8 * The Ascend Environment is free software; you can redistribute it
9 * and/or modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 *
13 * The Ascend Environment is distributed in 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 GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with the program; if not, write to the Free Software Foundation,
20 * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
21 * COPYING.
22 */
23
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <stdarg.h>
27
28 #include <utilities/ascConfig.h>
29 #include <utilities/ascPrint.h>
30 #include <compiler/redirectFile.h>
31
32 #define f_vtable_name "asc_test_vtable"
33
34 static struct Asc_PrintVTable f_vtable = {f_vtable_name, vfprintf, fflush, NULL};
35 static int f_vtable_registered = FALSE;
36
37 int test_enable_printing(void){
38 fprintf(stderr,"PRINTING ENABLED\n");
39 return TRUE;
40
41 /* old code... */
42 if (TRUE == f_vtable_registered) {
43 fprintf(stderr,"PRINTING *ALREADY* ENABLED\n");
44 return TRUE;
45 }
46 else {
47 fprintf(stderr,"PRINTING ENABLED\n");
48 f_vtable_registered = TRUE;
49 return (0 == Asc_PrintPushVTable(&f_vtable)) ? TRUE : FALSE ;
50 }
51 }
52
53
54 void test_disable_printing(void){
55 fprintf(stderr,"PRINTING DISABLED\n");
56 return;
57
58 /* old code... */
59 if (TRUE == f_vtable_registered) {
60 f_vtable_registered = FALSE;
61 Asc_PrintRemoveVTable(f_vtable_name);
62 }
63 }
64
65
66 int test_printing_enabled(void){
67 return TRUE;
68
69 return f_vtable_registered;
70 }
71

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22