summaryrefslogtreecommitdiffstats
path: root/ast/ast_tester/testobject.c
blob: fc5b24b5402451371c375330aa322dd970e90962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "ast.h"
#include <stdio.h>

main(){
   char *pickle1;
   char *pickle2;
   AstSkyFrame *sf = astSkyFrame( " " );
   AstFrame *bf = astFrame( 2, "Domain=SKY" );
   AstFrameSet *fs = astConvert( bf, sf, " " );

   if( fs ) {
      pickle1 = astToString( fs );
      AstFrameSet *fs2 = astFromString( pickle1 );
      pickle2 = astToString( fs2 );
      if( pickle1 && pickle2 ) {
         if( strcmp( pickle1, pickle2 ) && astOK ) {
            astError( AST__INTER, "Error 1\n" );
         }
      } else if( astOK ) {
         astError( AST__INTER, "Error 2\n" );
      }


      pickle1 = astFree( pickle1 );
      pickle2 = astFree( pickle2 );

      if( fs2 && !astEqual( fs, fs2 ) && astOK ) {
         astError( AST__INTER, "Error 3\n" );
      }

   } else if( astOK ){
      astError( AST__INTER, "Error 4\n"  );
   }

   if( astOK ) {
      printf(" All Object tests passed\n");
   } else {
      printf("Object tests failed\n");
   }
}