Esempio n. 1
0
int main(int argc, char **argv)
{
  int opt;

  ssh_regression_init(&argc, &argv, "Combined modes",
                      "*****@*****.**");

  while ((opt = ssh_getopt(argc, argv, "d:", NULL)) != EOF)
    {
      switch (opt)
        {
        case 'd':
          debuglevel = ssh_optarg;
          break;
        default:
          fprintf(stderr, "usage: t-combined-modes [-d debuglevel] \n");
          exit(1);
        }
    }


  if (ssh_crypto_library_initialize() != SSH_CRYPTO_OK)
    ssh_fatal("Crypto library initialization failed");

  if (debuglevel)
    ssh_debug_set_level_string(debuglevel);

  test_variant("");
  test_variant("-256");
  test_variant("-4k");
  test_variant("-8k");
  test_variant("-64k");

  ssh_crypto_library_uninitialize();
  ssh_debug_uninit();
  ssh_regression_finish();
  exit(0);
}
Esempio n. 2
0
int main()
{
    sio << "short: " << sizeof(short) << "  long: " << sizeof(long)
        << "  long long: " << sizeof(long long) << "  int: " << sizeof(int)
        << "  void*: " << sizeof(void*) << "  float: " << sizeof(float)
        << "  double: " << sizeof(double) << '\n';
    sio << "integer: " << sizeof(integer) << "  memint: " << sizeof(memint)
        << "  real: " << sizeof(real) << "  variant: " << sizeof(variant)
        << "  object: " << sizeof(object) << "  rtobject: " << sizeof(rtobject) << '\n';
    sio << "stateobj: " << sizeof(stateobj) << "  Type: " << sizeof(Type)
        << "  State: " << sizeof(State) << "  opcodes: " << opMaxCode << '\n';

    check(sizeof(memint) == sizeof(void*));
    check(sizeof(memint) == sizeof(size_t));

#ifdef SHN_64
    check(sizeof(integer) == 8);
    check(sizeof(variant) <= 16);
#else
    check(sizeof(integer) == 4);
    check(sizeof(variant) <= 12);
#endif

    initRuntime();
    initTypeSys();
    initVm();

    int exitcode = 0;
    try
    {
        test_common();
        test_object();
        test_ordset();
        test_bytevec();
        test_string();
        test_strutils();
        test_podvec();
        test_vector();
        test_dict();
        test_set();
        test_symtbl();
        test_variant();
        test_fifos();
        test_parser();
//        test_typesys();
//        test_codegen();
    }
    catch (exception& e)
    {
        fprintf(stderr, "Exception: %s\n", e.what());
        exitcode = 201;
    }

    doneVm();
    doneTypeSys();
    doneRuntime();

    if (object::allocated != 0)
    {
        fprintf(stderr, "Error: object::allocated = %d\n", object::allocated);
        exitcode = 202;
    }

    return exitcode;
}