Example #1
0
int main(int argc, char* argv[])
{
  DCCallVM* vm;
  DCValue ret;
  int r = 1;

  dcTest_initPlatform();

  /* allocate call vm */
  vm = dcNewCallVM(4096);


  /* calls using 'formatted' API */
  dcReset(vm);
  printf("callf iii)i:       ");
  dcCallF(vm, &ret, (void*)&vf_iii, "iii)i", 1, 2, 3);
  r = ret.i && r;

  dcReset(vm);
  printf("\ncallf ffiffiffi)i: ");
  dcCallF(vm, &ret, (void*)&vf_ffiffiffi, "ffiffiffi)i", 1.f, 2.f, 3, 4.f, 5.f, 6, 7.f, 8.f, 9);
  r = ret.i && r;


  /* arg binding then call using 'formatted' API */
  dcReset(vm);
  printf("\nargf iii)i       then call: ");
  dcArgF(vm, "iii)i", 1, 2, 3);
  r = r && dcCallInt(vm, (void*)&vf_iii);

  dcReset(vm);
  printf("\nargf iii         then call: ");
  dcArgF(vm, "iii", 1, 2, 3);
  r = r && dcCallInt(vm, (void*)&vf_iii);

  dcReset(vm);
  printf("\nargf ffiffiffi)i then call: ");
  dcArgF(vm, "ffiffiffi)i", 1.f, 2.f, 3, 4.f, 5.f, 6, 7.f, 8.f, 9);
  r = r && dcCallInt(vm, (void*)&vf_ffiffiffi);

  dcReset(vm);
  printf("\nargf ffiffiffi   then call: ");
  dcArgF(vm, "ffiffiffi", 1.f, 2.f, 3, 4.f, 5.f, 6, 7.f, 8.f, 9);
  r = r && dcCallInt(vm, (void*)&vf_ffiffiffi);


  /* free vm */
  dcFree(vm);

  printf("\nresult: callf: %d\n", r);

  dcTest_deInitPlatform();
  
  return 0;
}
Example #2
0
int main()
{
  int err;
  void* ptr;
  dcTest_initPlatform();

  err = dcAllocWX(23, &ptr);
  if(!err) dcFreeWX(ptr, 23);
  printf("result: test_alloc_wx: %d\n", (!err) ? 1 : 0 );

  dcTest_deInitPlatform();

  return err;
}
Example #3
0
int main(int argc, char* argv[] )
{
  int from = 1;
  int to = CONFIG_NSIGS;
  int ncases;

  int i;
  int pos;
  int number;
  int totalResult;

  dcTest_initPlatform();

  InitEnv();
  appname = argv[0];

  pos = 0;
  for(i = 1 ; i < argc ; ++i ) {

    if ( argv[i][0] == '-' ) {
      switch(argv[i][1]) {
        case 'v': OptionVerbose = 1; continue;
        case 'h': PrintUsage(appname); return 0;
        default: Error("invalid option: %s", argv[i]);
      }      
    }

    number = atoi(argv[i]);
    switch(pos) {
      case 0: to   = from = number; ++pos; break;
      case 1: to   = number; break;
      default: Error("too many arguments%s", "");
    }
  }

  assert(from > 0);
  assert(to   <= CONFIG_NSIGS);
  assert(from <= to);

  ncases = (to - from) + 1;

  PrintHeader();
  TestRange(from, to);
  totalResult = (totalErrorCodes[1] == ncases) ? 1 : 0; 
  PrintTotalResult(totalResult);

  dcTest_deInitPlatform();

  return 0;
}
Example #4
0
int main(int argc, char* argv[])
{
  int total;

  dcTest_initPlatform();

  init_K(G_maxargs);
  G_callvm = (DCCallVM*) dcNewCallVM(4096);
  dcReset(G_callvm);
  total = run_all();
  printf("result: call_suite: %d\n", total);

  dcTest_deInitPlatform();

  return 0;
}
Example #5
0
int main()
{
  dcTest_initPlatform();

  printf("Allocating ...\n");
  printf("... W^X memory: ");
  test_wx();
  printf("... heap memory: ");
  test_heap();
  printf("... stack memory: ");
  test_stack();

  dcTest_deInitPlatform();

  return 0;
}
Example #6
0
int main()
{
  dcTest_initPlatform();

  signal(SIGSEGV, segv_handler);

  printf("Allocating ...\n");
  printf("... W^X memory: ");
  test_wx();
  printf("... heap memory: ");
  test_heap();
  printf("... stack memory: ");
  test_stack();

  dcTest_deInitPlatform();

  return 0;
}
Example #7
0
int main()
{
  DCCallback* cb;
  short result = 0;
  int userdata = 1337;

  dcTest_initPlatform();

  printf("about to callback...\n");
  cb = dcbNewCallback("ifsdl)s", &cbHandler, &userdata);
  result = ((short(*)(int, float, short, double, long long))cb)(123, 23.f, 3, 1.82, 9909ull);
  dcbFreeCallback(cb);
  printf("successfully returned from callback\n");
  printf("return value (should be 1234): %d\n", result);

  printf("result: callback_plain: %s\n", (userdata == 6) && (result == 1234) ? "1" : "0");

  dcTest_deInitPlatform();

  return 0;
}
Example #8
0
int main(int argc, char* argv[])
{
  DCCallVM* vm;
  DCValue r;

  dcTest_initPlatform();

  /* allocate call vm */
  vm = dcNewCallVM(4096);

  /* call using 'formatted' API */
  dcCallF(vm, &r, (void*) &vf_iii, "iii)i", 1, 2, 3);

  /* free vm */
  dcFree(vm);

  printf("result: callf: %d\n", r.i);

  dcTest_deInitPlatform();
  
  return 0;
}