ObjectLoaderTest.m
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:1k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. // Swarm library. Copyright (C) 1999, 2000 Swarm Development Group.
  2. // This library is distributed without any warranty; without even the
  3. // implied warranty of merchantability or fitness for a particular purpose.
  4. // See file LICENSE for details and terms of copying.
  5. #import <simtools.h>
  6. #import "TestObject.h"
  7. #include <misc.h>
  8. int
  9. main(int argc, const char ** argv) 
  10. {
  11.   TestObject * theObj;
  12.   char fileName[128];
  13.   initSwarmBatch(argc, argv);
  14.   theObj = [TestObject createBegin: globalZone];
  15.   theObj =[theObj createEnd];
  16.   sprintf(fileName, "%s/test.data", getenv("srcdir"));
  17.   
  18.   [ObjectLoader load: theObj fromFileNamed: fileName];
  19.   [theObj printObject];
  20.   if ([theObj getVar1] != 2)
  21.     {
  22.       fprintf(stderr, 
  23.               "ObjectLoader incorrectly stored var1 instance variablen");
  24.       return 1;
  25.     }
  26.   if ([theObj getVar2] != 3)
  27.     {
  28.       fprintf(stderr, 
  29.               "ObjectLoader incorrectly stored var2 instance variablen");
  30.       return 1;
  31.     }
  32.   if ([theObj getChar1] != 'a')
  33.     {
  34.       fprintf(stderr, 
  35.               "ObjectLoader incorrectly stored char1 instance variablen");
  36.       return 1;
  37.     }
  38.   return 0;
  39. }