home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / objam01.lha / objam / test / objcTest.m < prev    next >
Encoding:
Text File  |  1995-02-14  |  649 b   |  35 lines

  1. #include <stdio.h>
  2. #include <objc/objc.h>
  3. #include "fooObject.h"
  4.  
  5.  
  6. void testfoo(void)
  7. {
  8.   id foo;
  9.  
  10.   if(foo=[FooObject new])
  11.   {
  12.     printf("Value 1: %d\n", [[foo setFoo:42] getFoo]);
  13.     printf("Value 2: %d\n", [[foo setFoo:17] getFoo]);
  14.     if(!([foo storeOn:"ram:foo.tds"])) puts("Error writing object.");
  15.     printf("Default zone: %x\n",NXDefaultMallocZone());
  16.     [foo printForDebugger];
  17.     [foo free];
  18.   }
  19.   else puts("Error creating object.");
  20.  
  21.   if(foo=[FooObject readFrom:"ram:foo.tds"])
  22.   {
  23.     printf("Value: %d\n", [foo getFoo]);
  24.     [foo free];
  25.   }
  26.   else puts("Error reading object.");
  27. }
  28.  
  29.  
  30. int main(void)
  31. {
  32.   testfoo();
  33.   return 0;
  34. }
  35.