示例#1
0
  void uuidHashTest()
  {
    shared_ptr<PluginContext> _pc(new PluginContext());
    HandleScope handleScope;
    Context::Scope context_scope(_pc->getContext());

    // From the standard Uuid Test
    // QUuid r = UuidHelper::createUuid5("foo", QUuid("{6ba7b812-9dad-11d1-80b4-00c04fd430c8}"));
    // HOOT_STR_EQUALS("{bca95adb-b5f1-564f-96a7-6355c52d1fa7}", r.toString());

    conf().set(ConfigOptions().getUuidHelperRepeatableKey(), true);
    HOOT_STR_EQUALS(fixQ("'{b18057ff-736d-5d20-b873-837f0c172e33}'"),
                    _pc->eval("hoot.UuidHelper.createUuid()"));

    HOOT_STR_EQUALS(fixQ("'{f1a68c36-8474-5aa5-93ab-8a95ef41050b}'"),
                    _pc->eval("hoot.UuidHelper.createUuid5('bar')"));

    HOOT_STR_EQUALS(fixQ("'{bca95adb-b5f1-564f-96a7-6355c52d1fa7}'"),
                    _pc->eval("hoot.UuidHelper.createUuid5('foo', '{6ba7b812-9dad-11d1-80b4-00c04fd430c8}')"));

  }
示例#2
0
 void
 checkSimpleQuantisation ()
   {
     FixedFrameQuantiser fixQ(25);
     
     uint frames = (rand() % MAX_FRAMES);
     FSecs dirt  = (F25 / (2 + rand() % DIRT_GRAIN));
     
     Time rawTime = Time(frames*F25) + Duration(dirt);            ////////////////TICKET #939 : should better use 64bit base type for FSecs ??
     
     CHECK (Time( frames   *F25) <= rawTime);
     CHECK (Time((frames+1)*F25) >  rawTime);
     
     Time quantTime (fixQ.gridAlign (rawTime));
     
     CHECK (Time(frames*F25) == quantTime);
   }