diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2016-10-17 15:22:52 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2016-10-17 15:22:52 (GMT) |
commit | 7dd9b970cec6832b8f6118dc2dd91a08d2836648 (patch) | |
tree | 4b3c86596ab87f35a3c6213397da07afe1e24d3e /ast/ast_tester/testobject.c | |
parent | d7bf7c61e8507e3cf51f195392c0f41f27ae18d8 (diff) | |
parent | 7fde2daeed593684120d75de07598154f3ddaf2c (diff) | |
download | blt-7dd9b970cec6832b8f6118dc2dd91a08d2836648.zip blt-7dd9b970cec6832b8f6118dc2dd91a08d2836648.tar.gz blt-7dd9b970cec6832b8f6118dc2dd91a08d2836648.tar.bz2 |
Merge commit '7fde2daeed593684120d75de07598154f3ddaf2c' as 'ast'
Diffstat (limited to 'ast/ast_tester/testobject.c')
-rw-r--r-- | ast/ast_tester/testobject.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/ast/ast_tester/testobject.c b/ast/ast_tester/testobject.c new file mode 100644 index 0000000..fc5b24b --- /dev/null +++ b/ast/ast_tester/testobject.c @@ -0,0 +1,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"); + } +} |