summaryrefslogtreecommitdiffstats
path: root/ast/ast_tester/testobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast/ast_tester/testobject.c')
-rw-r--r--ast/ast_tester/testobject.c40
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");
+ }
+}