static int test_2_TriggerPolicy() { swi_status_t res = swi_av_Init(); if (res != SWI_STATUS_OK) return res; //trigger default policy res = swi_av_TriggerPolicy(NULL ); if (res != SWI_STATUS_OK) return res; //trigger one existing policy res = swi_av_TriggerPolicy("now"); if (res != SWI_STATUS_OK) return res; //trigger "never" policy: this must fail res = swi_av_TriggerPolicy("never"); if (res == SWI_STATUS_OK) return res; //test using unknown policy res = swi_av_TriggerPolicy("plop"); if (res == SWI_STATUS_OK) return res; res = swi_av_Destroy(); if (res != SWI_STATUS_OK) return res; return 0; }
static int test_6_Acknowledge() { swi_status_t res; res = swi_av_Init(); if (res != SWI_STATUS_OK) return res; res = swi_av_Acknowledge(0, 0, "BANG BANG BANG", "now", 0); if (res != SWI_STATUS_OK) return res; res = swi_av_TriggerPolicy("now"); if (res != SWI_STATUS_OK) return res; return 0; }
static int test_6_Acknowledge() { rc_ReturnCode_t res; res = swi_av_Init(); if (res != RC_OK) return res; res = swi_av_Acknowledge(0, 0, "BANG BANG BANG", "now", 0); if (res != RC_OK) return res; res = swi_av_TriggerPolicy("now"); if (res != RC_OK) return res; return 0; }
static int test_5_asset_pushData() { swi_status_t res = swi_av_Init(); if (res != SWI_STATUS_OK) return 1; swi_av_Asset_t* asset; res = swi_av_asset_Create(&asset, ASSET_ID); if (res != SWI_STATUS_OK) return res; res = swi_av_asset_Start(asset); if (res != SWI_STATUS_OK) return res; //"long" path res = swi_av_asset_PushInteger(asset, "titi.test.toto1", "now", SWI_AV_TSTAMP_AUTO, 42); if (res != SWI_STATUS_OK) return res; //"short" path res = swi_av_asset_PushInteger(asset, "titi.toto2", "now", SWI_AV_TSTAMP_AUTO, 43); if (res != SWI_STATUS_OK) return res; //"shortest" path res = swi_av_asset_PushInteger(asset, "toto3", "now", SWI_AV_TSTAMP_AUTO, 44); if (res != SWI_STATUS_OK) return res; //"shortest" path, no timestamp res = swi_av_asset_PushInteger(asset, "toto4", "now", SWI_AV_TSTAMP_NO, 45); if (res != SWI_STATUS_OK) return res; //"shortest" path, no timestamp, no policy res = swi_av_asset_PushInteger(asset, "toto5", NULL, SWI_AV_TSTAMP_AUTO, 46); if (res != SWI_STATUS_OK) return res; //"shortest" path, manual timestamp, no policy res = swi_av_asset_PushInteger(asset, "toto6", NULL, 23, 47); if (res != SWI_STATUS_OK) return res; res = swi_av_asset_PushFloat(asset, "toto7", "now", SWI_AV_TSTAMP_AUTO, 47.455555); if (res != SWI_STATUS_OK) return res; res = swi_av_asset_PushString(asset, "toto8", "now", SWI_AV_TSTAMP_AUTO, "foo"); if (res != SWI_STATUS_OK) return res; res = swi_av_asset_PushString(asset, "toto8", "now", SWI_AV_TSTAMP_AUTO, NULL ); if (res != SWI_STATUS_WRONG_PARAMS) return res; res = swi_av_TriggerPolicy("*"); if (res != SWI_STATUS_OK) return res; res = swi_av_asset_Destroy(asset); if (res != SWI_STATUS_OK) return res; return 0; }