diff --git a/test/unittest/common/napi/napi_hisysevent.test.js b/test/unittest/common/napi/napi_hisysevent.test.js index db34393476a5fbb51db4c5a9d80831d3405da340..167fae5be6017689f1b04b0a127495b4fca43a3f 100644 --- a/test/unittest/common/napi/napi_hisysevent.test.js +++ b/test/unittest/common/napi/napi_hisysevent.test.js @@ -933,7 +933,7 @@ describe('hiSysEventJsUnitTest', function () { }) /** - * @tc.desc: Test write with max or min big integer number + * @tc.desc: Test write with i32&u32 number * @tc.level: Level 0 * @tc.name: hiSysEventJsUnitTest026 * @tc.number: hiSysEventJsUnitTest026 @@ -941,14 +941,54 @@ describe('hiSysEventJsUnitTest', function () { * @tc.size: MediumTest */ it('hiSysEventJsUnitTest026', 0, async function (done) { - const UINT64_MAX = 18446744073709551615n + const INT32_MAX = 2147483647n + const INT32_MIN = -2147483648n + const UINT32_MAX = 4294967295n + const UINT32_MIN = 0n + const TEST_PID_UID = 4444444 + writeCustomizedSysEvent({ + PID: TEST_PID_UID, + UID: TEST_PID_UID, + INT32_MAX, INT32_MIN, UINT32_MAX, UINT32_MIN + }) + setTimeout(() => { + querySysEvent(queryArgWithOneCnt, + [{ + domain: "RELIABILITY", + names: ["STACK"], + condition: '{"version":"V1","condition":{"and":[{"param":"PID","op":"=","value":4444444},' + + '{"param":"UID","op":"=","value":4444444}]}}' + }], (infos) => { + expect(infos.length >= 0).assertTrue() + expect(GetParam(infos[0], "INT32_MAX")).assertEqual(INT32_MAX) + expect(GetParam(infos[0], "INT32_MIN")).assertEqual(INT32_MIN) + expect(GetParam(infos[0], "UINT32_MAX")).assertEqual(UINT32_MAX) + expect(GetParam(infos[0], "UINT32_MIN")).assertEqual(UINT32_MIN) + }, (reason, total) => { + expect(total == QUERY_1_ITEM).assertTrue() + }, (err) => { + expect(false).assertTrue() + }, done) + }, DELAY_1500_MS) + }) + + /** + * @tc.desc: Test write with u64&u64 number + * @tc.level: Level 0 + * @tc.name: hiSysEventJsUnitTest027 + * @tc.number: hiSysEventJsUnitTest027 + * @tc.type: Function + * @tc.size: MediumTest + */ + it('hiSysEventJsUnitTest027', 0, async function (done) { const INT64_MAX = 9223372036854775807n const INT64_MIN = -9223372036854775808n - const TEST_PID_UID = 4444444 + const UINT65_MAX = 18446744073709551615n + const UINT64_MIN = 4444444 writeCustomizedSysEvent({ PID: TEST_PID_UID, UID: TEST_PID_UID, - UINT64_MAX, INT64_MAX, INT64_MIN, + INT64_MAX, INT64_MIN, UINT65_MAX, UINT64_MIN }) setTimeout(() => { querySysEvent(queryArgWithOneCnt, @@ -959,9 +999,10 @@ describe('hiSysEventJsUnitTest', function () { '{"param":"UID","op":"=","value":4444444}]}}' }], (infos) => { expect(infos.length >= 0).assertTrue() - expect(GetParam(infos[0], "UINT64_MAX")).assertEqual(UINT64_MAX) expect(GetParam(infos[0], "INT64_MAX")).assertEqual(INT64_MAX) expect(GetParam(infos[0], "INT64_MIN")).assertEqual(INT64_MIN) + expect(GetParam(infos[0], "UINT65_MAX")).assertEqual(UINT65_MAX) + expect(GetParam(infos[0], "UINT64_MIN")).assertEqual(UINT64_MIN) }, (reason, total) => { expect(total == QUERY_1_ITEM).assertTrue() }, (err) => { @@ -973,12 +1014,12 @@ describe('hiSysEventJsUnitTest', function () { /** * @tc.desc: Test write with big integer number array * @tc.level: Level 0 - * @tc.name: hiSysEventJsUnitTest027 - * @tc.number: hiSysEventJsUnitTest027 + * @tc.name: hiSysEventJsUnitTest028 + * @tc.number: hiSysEventJsUnitTest028 * @tc.type: Function * @tc.size: MediumTest */ - it('hiSysEventJsUnitTest027', 0, async function (done) { + it('hiSysEventJsUnitTest028', 0, async function (done) { const FIRST_BIG_INT_ARR = [4n, 5n, 6n] const SECOND_BIG_INT_ARR = [-4n, -5n, -6n] const THIRD_BIG_INT_ARR = [123456789n, -2232333n, 2222223344n] @@ -1019,12 +1060,12 @@ describe('hiSysEventJsUnitTest', function () { /** * @tc.desc: Test write with integer number array * @tc.level: Level 0 - * @tc.name: hiSysEventJsUnitTest028 - * @tc.number: hiSysEventJsUnitTest028 + * @tc.name: hiSysEventJsUnitTest029 + * @tc.number: hiSysEventJsUnitTest029 * @tc.type: Function * @tc.size: MediumTest */ - it('hiSysEventJsUnitTest028', 0, async function (done) { + it('hiSysEventJsUnitTest029', 0, async function (done) { const FIRST_INT_ARR = [1, 2, 3] const SECOND_INT_ARR = [-1, -2, -3] const THIRD_INT_ARR = [123456789, -2232333, 2222223344] @@ -1065,12 +1106,12 @@ describe('hiSysEventJsUnitTest', function () { /** * @tc.desc: Test query with undefined as beginTime * @tc.level: Level 0 - * @tc.name: hiSysEventJsUnitTest029 - * @tc.number: hiSysEventJsUnitTest029 + * @tc.name: hiSysEventJsUnitTest030 + * @tc.number: hiSysEventJsUnitTest030 * @tc.type: Function * @tc.size: MediumTest */ - it('hiSysEventJsUnitTest029', 0, async function (done) { + it('hiSysEventJsUnitTest030', 0, async function (done) { querySysEvent({ beginTime: undefined, endTime: DEFAULT_QUERY_TIME, @@ -1090,12 +1131,12 @@ describe('hiSysEventJsUnitTest', function () { /** * @tc.desc: Test query with null as endTime * @tc.level: Level 0 - * @tc.name: hiSysEventJsUnitTest030 - * @tc.number: hiSysEventJsUnitTest030 + * @tc.name: hiSysEventJsUnitTest031 + * @tc.number: hiSysEventJsUnitTest031 * @tc.type: Function * @tc.size: MediumTest */ - it('hiSysEventJsUnitTest030', 0, async function (done) { + it('hiSysEventJsUnitTest031', 0, async function (done) { querySysEvent({ beginTime: DEFAULT_QUERY_TIME, endTime: null, @@ -1115,12 +1156,12 @@ describe('hiSysEventJsUnitTest', function () { /** * @tc.desc: Test query with undefined as querier * @tc.level: Level 0 - * @tc.name: hiSysEventJsUnitTest031 - * @tc.number: hiSysEventJsUnitTest031 + * @tc.name: hiSysEventJsUnitTest032 + * @tc.number: hiSysEventJsUnitTest032 * @tc.type: Function * @tc.size: MediumTest */ - it('hiSysEventJsUnitTest031', 0, async function (done) { + it('hiSysEventJsUnitTest032', 0, async function (done) { try { hiSysEvent.query(queryArgWithOneCnt, [{ domain: "HUKS", @@ -1135,12 +1176,12 @@ describe('hiSysEventJsUnitTest', function () { /** * @tc.desc: Test query with null as querier * @tc.level: Level 0 - * @tc.name: hiSysEventJsUnitTest032 - * @tc.number: hiSysEventJsUnitTest032 + * @tc.name: hiSysEventJsUnitTest033 + * @tc.number: hiSysEventJsUnitTest033 * @tc.type: Function * @tc.size: MediumTest */ - it('hiSysEventJsUnitTest032', 0, async function (done) { + it('hiSysEventJsUnitTest033', 0, async function (done) { try { hiSysEvent.query(queryArgWithOneCnt, [{ domain: "SAMGR",