1/* 2 * Copyright (C) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' 16import dataRdb from '@ohos.data.rdb'; 17 18const TAG = "[RDB_JSKITS _TEST]" 19const CREATE_TABLE_ALL_DATA_TYPE_SQL = "CREATE TABLE IF NOT EXISTS AllDataType " 20 + "(id INTEGER PRIMARY KEY AUTOINCREMENT, " 21 + "integerValue INTEGER , longValue INTEGER , shortValue INTEGER , booleanValue INTEGER , " 22 + "doubleValue REAL , floatValue REAL , stringValue TEXT , blobValue BLOB , clobValue TEXT , " 23 + "byteValue INTEGER , dateValue INTEGER , timeValue INTEGER , timestampValue INTEGER , " 24 + "calendarValue INTEGER , characterValue TEXT , primIntValue INTEGER , primLongValue INTEGER , " 25 + "primShortValue INTEGER , primFloatValue REAL , primDoubleValue REAL , " 26 + "primBooleanValue INTEGER , primByteValue INTEGER , primCharValue TEXT, `order` INTEGER);"; 27 28const STORE_CONFIG = { 29 name: "Predicates.db", 30} 31var rdbStore = undefined; 32var DOUBLE_MAX = 9223372036854775807; 33describe('rdbPredicatesTest', function () { 34 beforeAll(async function () { 35 console.info(TAG + 'beforeAll') 36 rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1); 37 await rdbStore.executeSql(CREATE_TABLE_ALL_DATA_TYPE_SQL, null); 38 await buildAllDataType1(); 39 await buildAllDataType2(); 40 await buildAllDataType3(); 41 }) 42 43 beforeEach(function () { 44 console.info(TAG + 'beforeEach') 45 }) 46 47 afterEach(function () { 48 console.info(TAG + 'afterEach') 49 }) 50 51 afterAll(async function () { 52 console.info(TAG + 'afterAll') 53 rdbStore = null 54 await dataRdb.deleteRdbStore("Predicates.db"); 55 }) 56 57 async function buildAllDataType1() { 58 console.log(TAG + "buildAllDataType1 start"); 59 { 60 var u8 = new Uint8Array([1, 2, 3]) 61 const valueBucket = { 62 "integerValue": 2147483647, 63 "doubleValue": DOUBLE_MAX, 64 "booleanValue": true, 65 "floatValue": -0.123, 66 "longValue": 9223372036854775807, 67 "shortValue": 32767, 68 "characterValue": ' ', 69 "stringValue": "ABCDEFGHIJKLMN", 70 "blobValue": u8, 71 "byteValue": 127, 72 } 73 await rdbStore.insert("AllDataType", valueBucket) 74 } 75 } 76 77 async function buildAllDataType2() { 78 console.log(TAG + "buildAllDataType2 start"); 79 { 80 var u8 = new Uint8Array([1, 2, 3]) 81 const valueBucket = { 82 "integerValue": 1, 83 "doubleValue": 1.0, 84 "booleanValue": false, 85 "floatValue": 1.0, 86 "longValue": 1, 87 "shortValue": 1, 88 "characterValue": '中', 89 "stringValue": "ABCDEFGHIJKLMN", 90 "blobValue": u8, 91 "byteValue": 1, 92 } 93 await rdbStore.insert("AllDataType", valueBucket) 94 } 95 } 96 97 async function buildAllDataType3() { 98 console.log(TAG + "buildAllDataType3 start"); 99 { 100 var u8 = new Uint8Array([1, 2, 3]) 101 const valueBucket = { 102 "integerValue": -2147483648, 103 "doubleValue": Number.MIN_VALUE, 104 "booleanValue": false, 105 "floatValue": 0.1234567, 106 "longValue": -9223372036854775808, 107 "shortValue": -32768, 108 "characterValue": '#', 109 "stringValue": "ABCDEFGHIJKLMN", 110 "blobValue": u8, 111 "byteValue": -128, 112 } 113 await rdbStore.insert("AllDataType", valueBucket) 114 } 115 } 116 117 console.log(TAG + "*************Unit Test Begin*************"); 118 119 /** 120 * @tc.name predicates equalTo normal test 121 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0010 122 * @tc.desc predicates equalTo normal test 123 */ 124 it('testEqualTo0001', 0, async function (done) { 125 console.log(TAG + "************* testEqualTo0001 start *************"); 126 let predicates = new dataRdb.RdbPredicates("AllDataType"); 127 128 predicates.equalTo("booleanValue", true); 129 let result = await rdbStore.query(predicates); 130 expect(1).assertEqual(result.rowCount); 131 result.close() 132 result = null 133 134 done(); 135 console.log(TAG + "************* testEqualTo0001 end *************"); 136 }) 137 138 /** 139 * @tc.name predicates equalTo normal test 140 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0011 141 * @tc.desc predicates equalTo normal test 142 */ 143 it('testEqualTo0002', 0, async function (done) { 144 console.log(TAG + "************* testEqualTo0002 start *************"); 145 146 let predicates = new dataRdb.RdbPredicates("AllDataType"); 147 predicates.equalTo("byteValue", -128).or().equalTo("byteValue", 1); 148 let result = await rdbStore.query(predicates); 149 expect(2).assertEqual(result.rowCount); 150 result.close() 151 result = null 152 153 done(); 154 console.log(TAG + "************* testEqualTo0002 end *************"); 155 }) 156 157 /** 158 * @tc.name predicates equalTo normal test 159 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0012 160 * @tc.desc predicates equalTo normal test 161 */ 162 it('testEqualTo0003', 0, async function (done) { 163 console.log(TAG + "************* testEqualTo0003 start *************"); 164 165 let predicates = new dataRdb.RdbPredicates("AllDataType"); 166 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN"); 167 let result = await rdbStore.query(predicates); 168 expect(3).assertEqual(result.rowCount); 169 result.close() 170 result = null 171 172 done(); 173 console.log(TAG + "************* testEqualTo0003 end *************"); 174 }) 175 176 /** 177 * @tc.name predicates equalTo normal test 178 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0013 179 * @tc.desc predicates equalTo normal test 180 */ 181 it('testEqualTo0004', 0, async function (done) { 182 console.log(TAG + "************* testEqualTo0004 start *************"); 183 184 let predicates = new dataRdb.RdbPredicates("AllDataType"); 185 predicates.equalTo("doubleValue", DOUBLE_MAX); 186 let result = await rdbStore.query(predicates); 187 expect(1).assertEqual(result.rowCount); 188 result.close() 189 result = null 190 191 done(); 192 console.log(TAG + "************* testEqualTo0004 end *************"); 193 }) 194 195 /** 196 * @tc.name predicates equalTo normal test 197 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0014 198 * @tc.desc predicates equalTo normal test 199 */ 200 it('testEqualTo0005', 0, async function (done) { 201 console.log(TAG + "************* testEqualTo0005 start *************"); 202 203 let predicates = new dataRdb.RdbPredicates("AllDataType"); 204 predicates.equalTo("shortValue", -32768.0); 205 let result = await rdbStore.query(predicates); 206 expect(1).assertEqual(result.rowCount); 207 result.close() 208 result = null 209 210 done(); 211 console.log(TAG + "************* testEqualTo0005 end *************"); 212 }) 213 214 /** 215 * @tc.name predicates equalTo normal test 216 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0015 217 * @tc.desc predicates equalTo normal test 218 */ 219 it('testEqualTo0006', 0, async function (done) { 220 console.log(TAG + "************* testEqualTo0006 start *************"); 221 222 let predicates = new dataRdb.RdbPredicates("AllDataType"); 223 predicates.equalTo("integerValue", 1); 224 let result = await rdbStore.query(predicates); 225 expect(true).assertEqual(result.goToFirstRow()); 226 expect(2).assertEqual(result.getLong(0)); 227 result.close() 228 229 done(); 230 console.log(TAG + "************* testEqualTo0006 end *************"); 231 }) 232 233 /** 234 * @tc.name predicates equalTo normal test 235 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0016 236 * @tc.desc predicates equalTo normal test 237 */ 238 it('testEqualTo0007', 0, async function (done) { 239 console.log(TAG + "************* testEqualTo0007 start *************"); 240 241 let predicates = new dataRdb.RdbPredicates("AllDataType"); 242 predicates.equalTo("longValue", 1); 243 let result = await rdbStore.query(predicates); 244 expect(true).assertEqual(result.goToFirstRow()); 245 expect(2).assertEqual(result.getLong(0)) 246 result.close() 247 248 done(); 249 console.log(TAG + "************* testEqualTo0007 end *************"); 250 }) 251 252 /** 253 * @tc.name predicates equalTo normal test 254 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0017 255 * @tc.desc predicates equalTo normal test 256 */ 257 it('testEqualTo0008', 0, async function (done) { 258 console.log(TAG + "************* testEqualTo0008 start *************"); 259 260 let predicates = new dataRdb.RdbPredicates("AllDataType"); 261 predicates.equalTo("floatValue", -0.123); 262 let result = await rdbStore.query(predicates); 263 expect(true).assertEqual(result.goToFirstRow()); 264 expect(1).assertEqual(result.getLong(0)) 265 result.close() 266 result = null 267 268 done(); 269 console.log(TAG + "************* testEqualTo0008 end *************"); 270 }) 271 272 273 /** 274 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0018 275 * @tc.name predicates equalTo test 276 * @tc.desc 1.equalTo normal test 277 * 2.equalTo abnormal test 278 */ 279 it('testEqualTo0009', 0, async function (done) { 280 console.log(TAG + "************* testEqualTo0009 start *************"); 281 282 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 283 predicates1.equalTo('1', 1); 284 let result1 = await rdbStore.query(predicates1); 285 expect(true).assertEqual(result1.goToFirstRow()); 286 expect(3).assertEqual(result1.rowCount) 287 result1.close() 288 result1 = null 289 290 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 291 predicates2.equalTo('1', Number.NaN); 292 let result2 = await rdbStore.query(predicates2); 293 expect(0).assertEqual(result2.rowCount) 294 result2.close() 295 result2 = null 296 297 done(); 298 console.log(TAG + "************* testEqualTo0009 end *************"); 299 }) 300 301 /** 302 * @tc.name predicates notEqualTo normal test 303 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0020 304 * @tc.desc predicates notEqualTo normal test 305 */ 306 it('testNotEqualTo0001', 0, async function (done) { 307 console.log(TAG + "************* testNotEqualTo0001 start *************"); 308 309 let predicates = new dataRdb.RdbPredicates("AllDataType"); 310 predicates.notEqualTo("booleanValue", true); 311 let result = await rdbStore.query(predicates); 312 expect(2).assertEqual(result.rowCount); 313 result.close() 314 result = null 315 316 done(); 317 console.log(TAG + "************* testNotEqualTo0001 end *************"); 318 }) 319 320 /** 321 * @tc.name predicates notEqualTo normal test 322 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0021 323 * @tc.desc predicates notEqualTo normal test 324 */ 325 it('testNotEqualTo0002', 0, async function (done) { 326 console.log(TAG + "************* testNotEqualTo0002 start *************"); 327 328 let predicates = new dataRdb.RdbPredicates("AllDataType"); 329 predicates.notEqualTo("byteValue", -128); 330 predicates.notEqualTo("byteValue", 1); 331 let result = await rdbStore.query(predicates); 332 expect(1).assertEqual(result.rowCount); 333 result.close() 334 result = null 335 336 done(); 337 console.log(TAG + "************* testNotEqualTo0002 end *************"); 338 }) 339 340 /** 341 * @tc.name predicates notEqualTo normal test 342 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0022 343 * @tc.desc predicates notEqualTo normal test 344 */ 345 it('testNotEqualTo0003', 0, async function (done) { 346 console.log(TAG + "************* testNotEqualTo0003 start *************"); 347 348 let predicates = new dataRdb.RdbPredicates("AllDataType"); 349 predicates.notEqualTo("stringValue", "ABCDEFGHIJKLMN"); 350 let result = await rdbStore.query(predicates); 351 expect(0).assertEqual(result.rowCount); 352 result.close() 353 result = null 354 355 done(); 356 console.log(TAG + "************* testNotEqualTo0003 end *************"); 357 }) 358 359 /** 360 * @tc.name predicates notEqualTo normal test 361 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0023 362 * @tc.desc predicates notEqualTo normal test 363 */ 364 it('testNotEqualTo0004', 0, async function (done) { 365 console.log(TAG + "************* testNotEqualTo0004 start *************"); 366 367 let predicates = new dataRdb.RdbPredicates("AllDataType"); 368 predicates.notEqualTo("doubleValue", DOUBLE_MAX); 369 let result = await rdbStore.query(predicates); 370 expect(2).assertEqual(result.rowCount); 371 result.close() 372 result = null 373 374 done(); 375 console.log(TAG + "************* testNotEqualTo0004 end *************"); 376 }) 377 378 /** 379 * @tc.name predicates notEqualTo normal test 380 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0024 381 * @tc.desc predicates notEqualTo normal test 382 */ 383 it('testNotEqualTo0005', 0, async function (done) { 384 console.log(TAG + "************* testNotEqualTo0005 start *************"); 385 386 let predicates = new dataRdb.RdbPredicates("AllDataType"); 387 predicates.notEqualTo("shortValue", -32768); 388 let result = await rdbStore.query(predicates); 389 expect(2).assertEqual(result.rowCount); 390 result.close() 391 result = null 392 393 done(); 394 console.log(TAG + "************* testNotEqualTo0005 end *************"); 395 }) 396 397 /** 398 * @tc.name predicates notEqualTo normal test 399 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0025 400 * @tc.desc predicates notEqualTo normal test 401 */ 402 it('testNotEqualTo0006', 0, async function (done) { 403 console.log(TAG + "************* testNotEqualTo0006 start *************"); 404 405 let predicates = new dataRdb.RdbPredicates("AllDataType"); 406 predicates.notEqualTo("integerValue", 1); 407 let result = await rdbStore.query(predicates); 408 expect(2).assertEqual(result.rowCount); 409 result.close() 410 result = null 411 412 done(); 413 console.log(TAG + "************* testNotEqualTo0006 end *************"); 414 }) 415 416 /** 417 * @tc.name predicates notEqualTo normal test 418 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0026 419 * @tc.desc predicates notEqualTo normal test 420 */ 421 it('testNotEqualTo0007', 0, async function (done) { 422 console.log(TAG + "************* testNotEqualTo0007 start *************"); 423 424 let predicates = new dataRdb.RdbPredicates("AllDataType"); 425 predicates.notEqualTo("longValue", 1); 426 let result = await rdbStore.query(predicates); 427 expect(2).assertEqual(result.rowCount); 428 result.close() 429 result = null 430 431 done(); 432 console.log(TAG + "************* testNotEqualTo0007 end *************"); 433 }) 434 435 /** 436 * @tc.name predicates notEqualTo normal test 437 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0027 438 * @tc.desc predicates notEqualTo normal test 439 */ 440 it('testNotEqualTo0008', 0, async function (done) { 441 console.log(TAG + "************* testNotEqualTo0008 start *************"); 442 443 let predicates = new dataRdb.RdbPredicates("AllDataType"); 444 predicates.notEqualTo("floatValue", -0.123); 445 let result = await rdbStore.query(predicates); 446 expect(2).assertEqual(result.rowCount); 447 result.close() 448 result = null 449 450 done(); 451 console.log(TAG + "************* testNotEqualTo0008 end *************"); 452 }) 453 454 /** 455 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0028 456 * @tc.name predicates not equalTo test 457 * @tc.desc 1.predicates not equalTo normal test 458 * 2.predicates not equalTo abnormal test 459 */ 460 it('testNotEqualTo0009', 0, async function (done) { 461 console.log(TAG + "************* testNotEqualTo0009 start *************"); 462 463 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 464 predicates1.notEqualTo('1', 1); 465 let result1 = await rdbStore.query(predicates1); 466 expect(0).assertEqual(result1.rowCount) 467 result1.close() 468 result1 = null 469 470 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 471 predicates2.notEqualTo('1', Number.NaN); 472 let result2 = await rdbStore.query(predicates2); 473 expect(0).assertEqual(result2.rowCount) 474 result2.close() 475 result2 = null 476 477 done(); 478 console.log(TAG + "************* testNotEqualTo0009 end *************"); 479 }) 480 481 /** 482 * @tc.name predicates isNull normal test 483 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0030 484 * @tc.desc predicates isNull normal test 485 */ 486 it('testIsNull0001', 0, async function (done) { 487 console.log(TAG + "************* testIsNull001 start *************"); 488 let predicates = new dataRdb.RdbPredicates("AllDataType"); 489 predicates.isNull("primLongValue"); 490 let result = await rdbStore.query(predicates); 491 expect(3).assertEqual(result.rowCount); 492 result.close() 493 result = null 494 done(); 495 console.log(TAG + "************* testIsNull0001 end *************"); 496 }) 497 498 /** 499 * @tc.name predicates isNull normal test 500 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0031 501 * @tc.desc predicates isNull normal test 502 */ 503 it('testIsNull0002', 0, async function (done) { 504 console.log(TAG + "************* testIsNull0002 start *************"); 505 let predicates = new dataRdb.RdbPredicates("AllDataType"); 506 predicates.isNull("longValue"); 507 let result = await rdbStore.query(predicates); 508 expect(0).assertEqual(result.rowCount); 509 result.close() 510 result = null 511 done(); 512 console.log(TAG + "************* testIsNull0002 end *************"); 513 }) 514 515 /** 516 * @tc.name predicates isNull normal test 517 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0032 518 * @tc.desc predicates isNull normal test 519 */ 520 it('testIsNull0003', 0, async function (done) { 521 console.log(TAG + "************* testIsNull0003 start *************"); 522 let predicates = new dataRdb.RdbPredicates("AllDataType"); 523 predicates.isNull("stringValue"); 524 let result = await rdbStore.query(predicates); 525 expect(0).assertEqual(result.rowCount); 526 result.close() 527 result = null 528 done(); 529 console.log(TAG + "************* testIsNull0003 end *************"); 530 }) 531 532 /** 533 * @tc.name predicates isNull normal test 534 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0033 535 * @tc.desc predicates isNull normal test 536 */ 537 it('testIsNull0004', 0, async function (done) { 538 console.log(TAG + "************* testIsNull0004 start *************"); 539 let predicates = new dataRdb.RdbPredicates("AllDataType"); 540 predicates.isNull("stringValueX"); 541 let result = await rdbStore.query(predicates); 542 expect(-1).assertEqual(result.rowCount); 543 result.close() 544 result = null 545 done(); 546 console.log(TAG + "************* testIsNull0004 end *************"); 547 }) 548 549 /** 550 * @tc.name predicates isNotNull normal test 551 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0040 552 * @tc.desc predicates isNotNull normal test 553 */ 554 it('testIsNotNull0001', 0, async function (done) { 555 console.log(TAG + "************* testIsNotNull0001 start *************"); 556 let predicates = new dataRdb.RdbPredicates("AllDataType"); 557 predicates.isNotNull("primLongValue"); 558 let result = await rdbStore.query(predicates); 559 expect(0).assertEqual(result.rowCount); 560 result.close() 561 result = null 562 done(); 563 console.log(TAG + "************* testIsNotNull0001 end *************"); 564 }) 565 566 /** 567 * @tc.name predicates isNotNull normal test 568 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0041 569 * @tc.desc predicates isNotNull normal test 570 */ 571 it('testIsNotNull0002', 0, async function (done) { 572 console.log(TAG + "************* testIsNotNull0002 start *************"); 573 let predicates = new dataRdb.RdbPredicates("AllDataType"); 574 predicates.isNotNull("longValue"); 575 let result = await rdbStore.query(predicates); 576 expect(3).assertEqual(result.rowCount); 577 result.close() 578 result = null 579 done(); 580 console.log(TAG + "************* testIsNotNull0002 end *************"); 581 }) 582 583 /** 584 * @tc.name predicates isNotNull normal test 585 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0042 586 * @tc.desc predicates isNotNull normal test 587 */ 588 it('testIsNotNull0003', 0, async function (done) { 589 console.log(TAG + "************* testIsNotNull0003 start *************"); 590 let predicates = new dataRdb.RdbPredicates("AllDataType"); 591 predicates.isNotNull("stringValue"); 592 let result = await rdbStore.query(predicates); 593 expect(3).assertEqual(result.rowCount); 594 result.close() 595 result = null 596 done(); 597 console.log(TAG + "************* testIsNotNull0003 end *************"); 598 }) 599 600 /** 601 * @tc.name predicates isNotNull normal test 602 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0043 603 * @tc.desc predicates isNotNull normal test 604 */ 605 it('testIsNotNull0004', 0, async function (done) { 606 console.log(TAG + "************* testIsNotNull0004 start *************"); 607 let predicates = new dataRdb.RdbPredicates("AllDataType"); 608 predicates.isNotNull("stringValueX"); 609 let result = await rdbStore.query(predicates); 610 expect(-1).assertEqual(result.rowCount); 611 result.close() 612 result = null 613 done(); 614 console.log(TAG + "************* testIsNotNull0004 end *************"); 615 }) 616 617 /** 618 * @tc.name predicates greaterThan normal test 619 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0050 620 * @tc.desc predicates greaterThan normal test 621 */ 622 it('testGreaterThan0001', 0, async function (done) { 623 console.log(TAG + "************* testGreaterThan0001 start *************"); 624 625 let predicates = new dataRdb.RdbPredicates("AllDataType"); 626 predicates.greaterThan("stringValue", "ABC"); 627 let result = await rdbStore.query(predicates); 628 expect(3).assertEqual(result.rowCount); 629 result.close() 630 result = null 631 632 done(); 633 console.log(TAG + "************* testGreaterThan0001 end *************"); 634 }) 635 636 /** 637 * @tc.name predicates greaterThan normal test 638 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0051 639 * @tc.desc predicates greaterThan normal test 640 */ 641 it('testGreaterThan0002', 0, async function (done) { 642 console.log(TAG + "************* testGreaterThan0002 start *************"); 643 644 let predicates = new dataRdb.RdbPredicates("AllDataType"); 645 predicates.greaterThan("doubleValue", 0.0); 646 let result = await rdbStore.query(predicates); 647 expect(3).assertEqual(result.rowCount); 648 result.close() 649 result = null 650 651 done(); 652 console.log(TAG + "************* testGreaterThan0002 end *************"); 653 }) 654 655 /** 656 * @tc.name predicates greaterThan normal test 657 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0052 658 * @tc.desc predicates greaterThan normal test 659 */ 660 it('testGreaterThan0003', 0, async function (done) { 661 console.log(TAG + "************* testGreaterThan0003 start *************"); 662 663 let predicates = new dataRdb.RdbPredicates("AllDataType"); 664 predicates.greaterThan("integerValue", 1); 665 let result = await rdbStore.query(predicates); 666 expect(1).assertEqual(result.rowCount); 667 result.close() 668 result = null 669 670 done(); 671 console.log(TAG + "************* testGreaterThan0003 end *************"); 672 }) 673 674 /** 675 * @tc.name predicates greaterThan normal test 676 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0053 677 * @tc.desc predicates greaterThan normal test 678 */ 679 it('testGreaterThan0004', 0, async function (done) { 680 console.log(TAG + "************* testGreaterThan0004 start *************"); 681 682 let predicates = new dataRdb.RdbPredicates("AllDataType"); 683 predicates.greaterThan("longValue", 1); 684 let result = await rdbStore.query(predicates); 685 expect(1).assertEqual(result.rowCount); 686 result.close() 687 result = null 688 689 done(); 690 console.log(TAG + "************* testGreaterThan0004 end *************"); 691 }) 692 693 /** 694 * @tc.name predicates greaterThan normal test 695 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0054 696 * @tc.desc predicates greaterThan normal test 697 */ 698 it('testGreaterThan0005', 0, async function (done) { 699 console.log(TAG + "************* testGreaterThan0005 start *************"); 700 701 let predicates = new dataRdb.RdbPredicates("AllDataType"); 702 predicates.greaterThan("stringValue", "ZZZ"); 703 let result = await rdbStore.query(predicates); 704 expect(0).assertEqual(result.rowCount); 705 result.close() 706 result = null 707 708 done(); 709 console.log(TAG + "************* testGreaterThan0005 end *************"); 710 }) 711 712 /** 713 * @tc.name predicates greaterThan normal test 714 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0055 715 * @tc.desc predicates greaterThan normal test 716 */ 717 it('testGreaterThan0006', 0, async function (done) { 718 console.log(TAG + "************* testGreaterThan0006 start *************"); 719 720 let predicates = new dataRdb.RdbPredicates("AllDataType"); 721 predicates.greaterThan("doubleValue", 999.0); 722 let result = await rdbStore.query(predicates); 723 expect(1).assertEqual(result.rowCount); 724 result.close() 725 result = null 726 727 done(); 728 console.log(TAG + "************* testGreaterThan0006 end *************"); 729 }) 730 731 /** 732 * @tc.name predicates greaterThan normal test 733 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0056 734 * @tc.desc predicates greaterThan normal test 735 */ 736 it('testGreaterThan0007', 0, async function (done) { 737 console.log(TAG + "************* testGreaterThan0007 start *************"); 738 739 let predicates = new dataRdb.RdbPredicates("AllDataType"); 740 predicates.greaterThan("integerValue", -999); 741 let result = await rdbStore.query(predicates); 742 expect(2).assertEqual(result.rowCount); 743 result.close() 744 result = null 745 746 done(); 747 console.log(TAG + "************* testGreaterThan0007 end *************"); 748 }) 749 750 /** 751 * @tc.name predicates greaterThan normal test 752 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0057 753 * @tc.desc predicates greaterThan normal test 754 */ 755 it('testGreaterThan0008', 0, async function (done) { 756 console.log(TAG + "************* testGreaterThan0008 start *************"); 757 758 let predicates = new dataRdb.RdbPredicates("AllDataType"); 759 predicates.greaterThan("longValue", -999); 760 let result = await rdbStore.query(predicates); 761 expect(2).assertEqual(result.rowCount); 762 result.close() 763 result = null 764 765 done(); 766 console.log(TAG + "************* testGreaterThan0008 end *************"); 767 }) 768 769 /** 770 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0058 771 * @tc.name predicates greaterThan abnormal test 772 * @tc.desc 1.predicates greaterThan abnormal "Number.NaN" test 773 * 2.predicates greaterThan abnormal "Number.NEGATIVE_INFINITY" test 774 * 3.predicates greaterThan abnormal "Number.POSITIVE_INFINITY" test 775 * 4.predicates greaterThan abnormal "Number.MIN_SAFE_INTEGER" test 776 * 5.predicates greaterThan abnormal "Number.MAX_SAFE_INTEGER" test 777 */ 778 it('testGreaterThan0009', 0, async function (done) { 779 console.log(TAG + "************* testGreaterThan0009 start *************"); 780 781 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 782 predicates1.greaterThan("longValue", Number.NaN); 783 let result1 = await rdbStore.query(predicates1); 784 expect(0).assertEqual(result1.rowCount); 785 result1.close() 786 result1 = null 787 788 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 789 predicates2.greaterThan("longValue", Number.NEGATIVE_INFINITY); 790 let result2 = await rdbStore.query(predicates2); 791 expect(3).assertEqual(result2.rowCount); 792 result2.close() 793 result2 = null 794 795 let predicates3 = new dataRdb.RdbPredicates("AllDataType"); 796 predicates3.greaterThan("longValue", Number.POSITIVE_INFINITY); 797 let result3 = await rdbStore.query(predicates3); 798 expect(0).assertEqual(result3.rowCount); 799 result3.close() 800 result3 = null 801 802 let predicates4 = new dataRdb.RdbPredicates("AllDataType"); 803 predicates4.greaterThan("longValue", Number.MIN_SAFE_INTEGER); 804 let result4 = await rdbStore.query(predicates4); 805 expect(2).assertEqual(result4.rowCount); 806 result4.close() 807 result4 = null 808 809 let predicates5 = new dataRdb.RdbPredicates("AllDataType"); 810 predicates5.greaterThan("longValue", Number.MAX_SAFE_INTEGER); 811 let result5 = await rdbStore.query(predicates5); 812 expect(1).assertEqual(result5.rowCount); 813 result5.close() 814 result5 = null 815 816 done(); 817 console.log(TAG + "************* testGreaterThan0009 end *************"); 818 }) 819 820 /** 821 * @tc.name predicates greaterThanOrEqualTo normal test 822 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0060 823 * @tc.desc predicates greaterThanOrEqualTo normal test 824 */ 825 it('testGreaterThanOrEqualTo0001', 0, async function (done) { 826 console.log(TAG + "************* testGreaterThanOrEqualTo0001 start *************"); 827 828 let predicates = new dataRdb.RdbPredicates("AllDataType"); 829 predicates.greaterThanOrEqualTo("stringValue", "ABC"); 830 let result = await rdbStore.query(predicates); 831 expect(3).assertEqual(result.rowCount); 832 result.close() 833 result = null 834 835 done(); 836 console.log(TAG + "************* testGreaterThanOrEqualTo0001 end *************"); 837 }) 838 839 /** 840 * @tc.name predicates greaterThanOrEqualTo normal test 841 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0061 842 * @tc.desc predicates greaterThanOrEqualTo normal test 843 */ 844 it('testGreaterThanOrEqualTo0002', 0, async function (done) { 845 console.log(TAG + "************* testGreaterThanOrEqualTo0002 start *************"); 846 847 let predicates = new dataRdb.RdbPredicates("AllDataType"); 848 predicates.greaterThanOrEqualTo("doubleValue", 0.0); 849 let result = await rdbStore.query(predicates); 850 expect(3).assertEqual(result.rowCount); 851 result.close() 852 result = null 853 854 done(); 855 console.log(TAG + "************* testGreaterThanOrEqualTo0002 end *************"); 856 }) 857 858 /** 859 * @tc.name predicates greaterThanOrEqualTo normal test 860 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0062 861 * @tc.desc predicates greaterThanOrEqualTo normal test 862 */ 863 it('testGreaterThanOrEqualTo0003', 0, async function (done) { 864 console.log(TAG + "************* testGreaterThanOrEqualTo0003 start *************"); 865 866 let predicates = new dataRdb.RdbPredicates("AllDataType"); 867 predicates.greaterThanOrEqualTo("integerValue", 1); 868 let result = await rdbStore.query(predicates); 869 expect(2).assertEqual(result.rowCount); 870 result.close() 871 result = null 872 873 done(); 874 console.log(TAG + "************* testGreaterThanOrEqualTo0003 end *************"); 875 }) 876 877 /** 878 * @tc.name predicates greaterThanOrEqualTo normal test 879 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0063 880 * @tc.desc predicates greaterThanOrEqualTo normal test 881 */ 882 it('testGreaterThanOrEqualTo0004', 0, async function (done) { 883 console.log(TAG + "************* testGreaterThanOrEqualTo0004 start *************"); 884 885 let predicates = new dataRdb.RdbPredicates("AllDataType"); 886 predicates.greaterThanOrEqualTo("longValue", 1); 887 let result = await rdbStore.query(predicates); 888 expect(2).assertEqual(result.rowCount); 889 result.close() 890 result = null 891 892 done(); 893 console.log(TAG + "************* testGreaterThanOrEqualTo0004 end *************"); 894 }) 895 896 /** 897 * @tc.name predicates lessThan normal test 898 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0070 899 * @tc.desc predicates lessThan normal test 900 */ 901 it('testLessThan0001', 0, async function (done) { 902 console.log(TAG + "************* testLessThan0001 start *************"); 903 904 let predicates = new dataRdb.RdbPredicates("AllDataType"); 905 predicates.lessThan("stringValue", "ABD"); 906 let result = await rdbStore.query(predicates); 907 expect(3).assertEqual(result.rowCount); 908 result.close() 909 result = null 910 911 done(); 912 console.log(TAG + "************* testLessThan0001 end *************"); 913 }) 914 915 /** 916 * @tc.name predicates lessThan normal test 917 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0071 918 * @tc.desc predicates lessThan normal test 919 */ 920 it('testLessThan0002', 0, async function (done) { 921 console.log(TAG + "************* testLessThan0002 start *************"); 922 923 let predicates = new dataRdb.RdbPredicates("AllDataType"); 924 predicates.lessThan("doubleValue", 0.0); 925 let result = await rdbStore.query(predicates); 926 expect(0).assertEqual(result.rowCount); 927 result.close() 928 result = null 929 930 done(); 931 console.log(TAG + "************* testLessThan0002 end *************"); 932 }) 933 934 /** 935 * @tc.name predicates lessThan normal test 936 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0072 937 * @tc.desc predicates lessThan normal test 938 */ 939 it('testLessThan0003', 0, async function (done) { 940 console.log(TAG + "************* testLessThan0003 start *************"); 941 942 let predicates = new dataRdb.RdbPredicates("AllDataType"); 943 predicates.lessThan("integerValue", 1); 944 let result = await rdbStore.query(predicates); 945 expect(1).assertEqual(result.rowCount); 946 result.close() 947 result = null 948 949 done(); 950 console.log(TAG + "************* testLessThan0003 end *************"); 951 }) 952 953 /** 954 * @tc.name predicates lessThan normal test 955 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0073 956 * @tc.desc predicates lessThan normal test 957 */ 958 it('testLessThan0004', 0, async function (done) { 959 console.log(TAG + "************* testLessThan0004 start *************"); 960 961 let predicates = new dataRdb.RdbPredicates("AllDataType"); 962 predicates.lessThan("longValue", 1); 963 let result = await rdbStore.query(predicates); 964 expect(1).assertEqual(result.rowCount); 965 result.close() 966 result = null 967 968 done(); 969 console.log(TAG + "************* testLessThan0004 end *************"); 970 }) 971 972 /** 973 * @tc.name predicates lessThan normal test 974 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0074 975 * @tc.desc predicates lessThan normal test 976 */ 977 it('testLessThan0005', 0, async function (done) { 978 console.log(TAG + "************* testLessThan0005 start *************"); 979 980 let predicates = new dataRdb.RdbPredicates("AllDataType"); 981 predicates.lessThan("stringValue", "ABD"); 982 let result = await rdbStore.query(predicates); 983 expect(3).assertEqual(result.rowCount); 984 result.close() 985 result = null 986 987 done(); 988 console.log(TAG + "************* testLessThan0005 end *************"); 989 }) 990 991 /** 992 * @tc.name predicates lessThan normal test 993 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0075 994 * @tc.desc predicates lessThan normal test 995 */ 996 it('testLessThan0006', 0, async function (done) { 997 console.log(TAG + "************* testLessThan0006 start *************"); 998 999 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1000 predicates.lessThan("doubleValue", 1.0); 1001 let result = await rdbStore.query(predicates); 1002 expect(1).assertEqual(result.rowCount); 1003 result.close() 1004 result = null 1005 1006 done(); 1007 console.log(TAG + "************* testLessThan0006 end *************"); 1008 }) 1009 1010 /** 1011 * @tc.name predicates lessThan normal test 1012 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0076 1013 * @tc.desc predicates lessThan normal test 1014 */ 1015 it('testLessThan0007', 0, async function (done) { 1016 console.log(TAG + "************* testLessThan0007 start *************"); 1017 1018 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1019 predicates.lessThan("integerValue", -2147483648); 1020 let result = await rdbStore.query(predicates); 1021 expect(0).assertEqual(result.rowCount); 1022 result.close() 1023 result = null 1024 1025 done(); 1026 console.log(TAG + "************* testLessThan0007 end *************"); 1027 }) 1028 1029 /** 1030 * @tc.name predicates lessThan normal test 1031 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0077 1032 * @tc.desc predicates lessThan normal test 1033 */ 1034 it('testLessThan0008', 0, async function (done) { 1035 console.log(TAG + "************* testLessThan0008 start *************"); 1036 1037 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1038 predicates.lessThan("longValue", -9223372036854775808); 1039 let result = await rdbStore.query(predicates); 1040 expect(0).assertEqual(result.rowCount); 1041 result.close() 1042 result = null 1043 1044 done(); 1045 console.log(TAG + "************* testLessThan0008 end *************"); 1046 }) 1047 1048 /** 1049 * @tc.name predicates lessThanOrEqualTo normal test 1050 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0080 1051 * @tc.desc predicates lessThanOrEqualTo normal test 1052 */ 1053 it('testLessThanOrEqualTo0001', 0, async function (done) { 1054 console.log(TAG + "************* testLessThanOrEqualTo0001 start *************"); 1055 1056 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1057 predicates.lessThanOrEqualTo("stringValue", "ABD"); 1058 let result = await rdbStore.query(predicates); 1059 expect(3).assertEqual(result.rowCount); 1060 result.close() 1061 result = null 1062 1063 done(); 1064 console.log(TAG + "************* testLessThanOrEqualTo0001 end *************"); 1065 }) 1066 1067 /** 1068 * @tc.name predicates lessThanOrEqualTo normal test 1069 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0081 1070 * @tc.desc predicates lessThanOrEqualTo normal test 1071 */ 1072 it('testLessThanOrEqualTo0002', 0, async function (done) { 1073 console.log(TAG + "************* testLessThanOrEqualTo0002 start *************"); 1074 1075 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1076 predicates.lessThanOrEqualTo("doubleValue", 0.0); 1077 let result = await rdbStore.query(predicates); 1078 expect(0).assertEqual(result.rowCount); 1079 result.close() 1080 result = null 1081 1082 done(); 1083 console.log(TAG + "************* testLessThanOrEqualTo0002 end *************"); 1084 }) 1085 1086 /** 1087 * @tc.name predicates lessThanOrEqualTo normal test 1088 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0082 1089 * @tc.desc predicates lessThanOrEqualTo normal test 1090 */ 1091 it('testLessThanOrEqualTo0003', 0, async function (done) { 1092 console.log(TAG + "************* testLessThanOrEqualTo0003 start *************"); 1093 1094 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1095 predicates.lessThanOrEqualTo("integerValue", 1); 1096 let result = await rdbStore.query(predicates); 1097 expect(2).assertEqual(result.rowCount); 1098 result.close() 1099 result = null 1100 1101 done(); 1102 console.log(TAG + "************* testLessThanOrEqualTo0003 end *************"); 1103 }) 1104 1105 /** 1106 * @tc.name predicates lessThanOrEqualTo normal test 1107 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0083 1108 * @tc.desc predicates lessThanOrEqualTo normal test 1109 */ 1110 it('testLessThanOrEqualTo0004', 0, async function (done) { 1111 console.log(TAG + "************* testLessThanOrEqualTo0004 start *************"); 1112 1113 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1114 predicates.lessThanOrEqualTo("longValue", 1); 1115 let result = await rdbStore.query(predicates); 1116 expect(2).assertEqual(result.rowCount); 1117 result.close() 1118 result = null 1119 1120 done(); 1121 console.log(TAG + "************* testLessThanOrEqualTo0004 end *************"); 1122 }) 1123 1124 /** 1125 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0084 1126 * @tc.name predicates lessThanOrEqualTo abnormal test 1127 * @tc.desc 1.predicates lessThanOrEqualTo abnormal "Number.NaN" test 1128 * 2.predicates lessThanOrEqualTo abnormal "Number.NEGATIVE_INFINITY" test 1129 * 3.predicates lessThanOrEqualTo abnormal "Number.POSITIVE_INFINITY" test 1130 * 4.predicates lessThanOrEqualTo abnormal "Number.MAX_VALUE" test 1131 * 5.predicates lessThanOrEqualTo abnormal "Number.MIN_VALUE" test 1132 */ 1133 it('testLessThanOrEqualTo0005', 0, async function (done) { 1134 console.log(TAG + "************* testLessThanOrEqualTo0005 start *************"); 1135 1136 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 1137 predicates1.lessThanOrEqualTo("longValue", Number.NaN); 1138 let result1 = await rdbStore.query(predicates1); 1139 expect(0).assertEqual(result1.rowCount); 1140 result1.close() 1141 result1 = null 1142 1143 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 1144 predicates2.lessThanOrEqualTo("longValue", Number.NEGATIVE_INFINITY); 1145 let result2 = await rdbStore.query(predicates2); 1146 expect(0).assertEqual(result2.rowCount); 1147 result2.close() 1148 result2 = null 1149 1150 let predicates3 = new dataRdb.RdbPredicates("AllDataType"); 1151 predicates3.lessThanOrEqualTo("longValue", Number.POSITIVE_INFINITY); 1152 let result3 = await rdbStore.query(predicates3); 1153 expect(3).assertEqual(result3.rowCount); 1154 result3.close() 1155 result3 = null 1156 1157 let predicates4 = new dataRdb.RdbPredicates("AllDataType"); 1158 predicates4.lessThanOrEqualTo("longValue", Number.MAX_VALUE); 1159 let result4 = await rdbStore.query(predicates4); 1160 expect(3).assertEqual(result4.rowCount); 1161 result4.close() 1162 result4 = null 1163 1164 let predicates5 = new dataRdb.RdbPredicates("AllDataType"); 1165 predicates5.lessThanOrEqualTo("longValue", Number.MIN_VALUE); 1166 let result5 = await rdbStore.query(predicates5); 1167 expect(1).assertEqual(result5.rowCount); 1168 result5.close() 1169 result5 = null 1170 1171 done(); 1172 console.log(TAG + "************* testLessThanOrEqualTo0005 end *************"); 1173 }) 1174 1175 /** 1176 * @tc.name predicates between normal test 1177 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0090 1178 * @tc.desc predicates between normal test 1179 */ 1180 it('testBetween0001', 0, async function (done) { 1181 console.log(TAG + "************* testBetween0001 start *************"); 1182 1183 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1184 predicates.between("stringValue", "ABB", "ABD"); 1185 let result = await rdbStore.query(predicates); 1186 expect(3).assertEqual(result.rowCount); 1187 result.close() 1188 result = null 1189 1190 done(); 1191 console.log(TAG + "************* testBetween0001 end *************"); 1192 }) 1193 1194 /** 1195 * @tc.name predicates between normal test 1196 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0091 1197 * @tc.desc predicates between normal test 1198 */ 1199 it('testBetween0002', 0, async function (done) { 1200 console.log(TAG + "************* testBetween0002 start *************"); 1201 1202 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1203 predicates.between("doubleValue", 0.0, DOUBLE_MAX); 1204 let result = await rdbStore.query(predicates); 1205 expect(3).assertEqual(result.rowCount); 1206 result.close() 1207 result = null 1208 1209 done(); 1210 console.log(TAG + "************* testBetween0002 end *************"); 1211 }) 1212 1213 /** 1214 * @tc.name predicates between normal test 1215 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0092 1216 * @tc.desc predicates between normal test 1217 */ 1218 it('testBetween0003', 0, async function (done) { 1219 console.log(TAG + "************* testBetween0003 start *************"); 1220 1221 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1222 predicates.between("integerValue", 0, 1); 1223 let result = await rdbStore.query(predicates); 1224 expect(1).assertEqual(result.rowCount); 1225 result.close() 1226 result = null 1227 1228 done(); 1229 console.log(TAG + "************* testBetween0003 end *************"); 1230 }) 1231 1232 /** 1233 * @tc.name predicates between normal test 1234 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0093 1235 * @tc.desc predicates between normal test 1236 */ 1237 it('testBetween0004', 0, async function (done) { 1238 console.log(TAG + "************* testBetween0004 start *************"); 1239 1240 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1241 predicates.between("longValue", 0, 2); 1242 let result = await rdbStore.query(predicates); 1243 expect(1).assertEqual(result.rowCount); 1244 result.close() 1245 result = null 1246 1247 done(); 1248 console.log(TAG + "************* testBetween0004 end *************"); 1249 }) 1250 1251 /** 1252 * @tc.name predicates between normal test 1253 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0094 1254 * @tc.desc predicates between normal test 1255 */ 1256 it('testBetween0005', 0, async function (done) { 1257 console.log(TAG + "************* testBetween0005 start *************"); 1258 1259 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1260 predicates.between("stringValue", "ABB", "ABB"); 1261 let result = await rdbStore.query(predicates); 1262 expect(0).assertEqual(result.rowCount); 1263 result.close() 1264 result = null 1265 1266 done(); 1267 console.log(TAG + "************* testBetween0005 end *************"); 1268 }) 1269 1270 /** 1271 * @tc.name predicates between normal test 1272 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0095 1273 * @tc.desc predicates between normal test 1274 */ 1275 it('testBetween0006', 0, async function (done) { 1276 console.log(TAG + "************* testBetween0006 start *************"); 1277 1278 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1279 predicates.between("doubleValue", DOUBLE_MAX, DOUBLE_MAX); 1280 let result = await rdbStore.query(predicates); 1281 expect(1).assertEqual(result.rowCount); 1282 result.close() 1283 result = null 1284 1285 done(); 1286 console.log(TAG + "************* testBetween0006 end *************"); 1287 }) 1288 1289 /** 1290 * @tc.name predicates between normal test 1291 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0096 1292 * @tc.desc predicates between normal test 1293 */ 1294 it('testBetween0007', 0, async function (done) { 1295 console.log(TAG + "************* testBetween0007 start *************"); 1296 1297 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1298 predicates.between("integerValue", 1, 0); 1299 let result = await rdbStore.query(predicates); 1300 expect(0).assertEqual(result.rowCount); 1301 result.close() 1302 result = null 1303 1304 done(); 1305 console.log(TAG + "************* testBetween0007 end *************"); 1306 }) 1307 1308 /** 1309 * @tc.name predicates between normal test 1310 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0097 1311 * @tc.desc predicates between normal test 1312 */ 1313 it('testBetween0008', 0, async function (done) { 1314 console.log(TAG + "************* testBetween0008 start *************"); 1315 1316 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1317 predicates.between("longValue", 2, -1); 1318 let result = await rdbStore.query(predicates); 1319 expect(0).assertEqual(result.rowCount); 1320 result.close() 1321 result = null 1322 1323 done(); 1324 console.log(TAG + "************* testBetween0008 end *************"); 1325 }) 1326 1327 /** 1328 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0098 1329 * @tc.name predicates between abnormal test 1330 * @tc.desc 1.predicates between abnormal "Number.POSITIVE_INFINITY" test 1331 * 2.predicates between abnormal "Number.NEGATIVE_INFINITY" test 1332 * 3.predicates between abnormal "Number.NaN" test 1333 * 4.predicates between abnormal "Number.NaN" test 1334 * 5.predicates between abnormal "Number.MIN_VALUE" test 1335 * 6.predicates between abnormal "Number.MAX_VALUE" test 1336 */ 1337 it('testBetween0009', 0, async function (done) { 1338 console.log(TAG + "************* testBetween0009 start *************"); 1339 1340 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 1341 predicates1.between("longValue", 0, Number.POSITIVE_INFINITY); 1342 let result1 = await rdbStore.query(predicates1); 1343 expect(2).assertEqual(result1.rowCount); 1344 result1.close(); 1345 result1 = null 1346 1347 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 1348 predicates2.between("longValue", Number.NEGATIVE_INFINITY, 0); 1349 let result2 = await rdbStore.query(predicates2); 1350 expect(1).assertEqual(result2.rowCount); 1351 result2.close(); 1352 result2 = null 1353 1354 let predicates3 = new dataRdb.RdbPredicates("AllDataType"); 1355 predicates3.between("longValue", Number.NaN, 0); 1356 let result3 = await rdbStore.query(predicates3); 1357 expect(0).assertEqual(result3.rowCount); 1358 result3.close(); 1359 result3 = null 1360 1361 let predicates4 = new dataRdb.RdbPredicates("AllDataType"); 1362 predicates4.between("longValue", 0, Number.NaN); 1363 let result4 = await rdbStore.query(predicates4); 1364 expect(0).assertEqual(result4.rowCount); 1365 result4.close(); 1366 result4 = null 1367 1368 let predicates5 = new dataRdb.RdbPredicates("AllDataType"); 1369 predicates5.between("longValue", Number.MIN_VALUE, 0); 1370 let result5 = await rdbStore.query(predicates5); 1371 expect(0).assertEqual(result5.rowCount); 1372 result5.close(); 1373 result5 = null 1374 1375 let predicates6 = new dataRdb.RdbPredicates("AllDataType"); 1376 predicates6.between("longValue", 0, Number.MAX_VALUE); 1377 let result6 = await rdbStore.query(predicates6); 1378 expect(2).assertEqual(result6.rowCount); 1379 result6.close(); 1380 result6 = null 1381 1382 done(); 1383 console.log(TAG + "************* testBetween0009 end *************"); 1384 }) 1385 1386 /** 1387 * @tc.name testNotBetween0001 1388 * @tc.number I4JWCV 1389 * @tc.desc test string value with notBetween. 1390 */ 1391 it('testNotBetween0001', 0, async function (done) { 1392 console.log(TAG + "************* testNotBetween0001 start *************"); 1393 1394 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1395 predicates.notBetween("stringValue", "ABB", "ABD"); 1396 let result = await rdbStore.query(predicates); 1397 expect(0).assertEqual(result.rowCount); 1398 result.close(); 1399 result = null 1400 1401 done(); 1402 console.log(TAG + "************* testNotBetween0001 end *************"); 1403 }) 1404 1405 /** 1406 * @tc.name testNotBetween0002 1407 * @tc.number I4JWCV 1408 * @tc.desc test double value with notBetween. 1409 */ 1410 it('testNotBetween0002', 0, async function (done) { 1411 console.log(TAG + "************* testNotBetween0002 start *************"); 1412 1413 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1414 predicates.notBetween("doubleValue", 0.0, DOUBLE_MAX); 1415 let result = await rdbStore.query(predicates); 1416 expect(0).assertEqual(result.rowCount); 1417 result.close(); 1418 result = null 1419 1420 done(); 1421 console.log(TAG + "************* testNotBetween0002 end *************"); 1422 }) 1423 1424 /** 1425 * @tc.name testNotBetween0003 1426 * @tc.number I4JWCV 1427 * @tc.desc test integer value with notBetween. 1428 */ 1429 it('testNotBetween0003', 0, async function (done) { 1430 console.log(TAG + "************* testNotBetween0003 start *************"); 1431 1432 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1433 predicates.notBetween("integerValue", 0, 1); 1434 let result = await rdbStore.query(predicates); 1435 expect(2).assertEqual(result.rowCount); 1436 result.close(); 1437 result = null 1438 1439 done(); 1440 console.log(TAG + "************* testNotBetween0003 end *************"); 1441 }) 1442 1443 /** 1444 * @tc.name testNotBetween0004 1445 * @tc.number I4JWCV 1446 * @tc.desc test long value with notBetween. 1447 */ 1448 it('testNotBetween0004', 0, async function (done) { 1449 console.log(TAG + "************* testNotBetween0004 start *************"); 1450 1451 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1452 predicates.notBetween("longValue", 0, 2); 1453 let result = await rdbStore.query(predicates); 1454 expect(2).assertEqual(result.rowCount); 1455 result.close(); 1456 result = null 1457 1458 done(); 1459 console.log(TAG + "************* testNotBetween0004 end *************"); 1460 }) 1461 1462 1463 /** 1464 * @tc.number testNotBetween0005 1465 * @tc.name test long value with notBetween. 1466 * @tc.desc 1.predicates between abnormal "Number.NaN" test 1467 * 2.predicates between abnormal "Number.NaN" test 1468 * 3.predicates between abnormal "Number.MIN_VALUE" test 1469 * 4.predicates between abnormal "Number.MAX_VALUE" test 1470 * 5.predicates between abnormal "Number.NEGATIVE_INFINITY" test 1471 * 6.predicates between abnormal "Number.POSITIVE_INFINITY" test 1472 */ 1473 it('testNotBetween0005', 0, async function (done) { 1474 console.log(TAG + "************* testNotBetween0005 start *************"); 1475 1476 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 1477 predicates1.notBetween("longValue", 0, Number.NaN); 1478 let result = await rdbStore.query(predicates1); 1479 expect(1).assertEqual(result.rowCount); 1480 result.close(); 1481 1482 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 1483 predicates2.notBetween("longValue", Number.NaN, 0); 1484 result = await rdbStore.query(predicates2); 1485 expect(2).assertEqual(result.rowCount); 1486 result.close(); 1487 1488 let predicates3 = new dataRdb.RdbPredicates("AllDataType"); 1489 predicates3.notBetween("longValue", Number.MIN_VALUE, 0); 1490 result = await rdbStore.query(predicates3); 1491 expect(3).assertEqual(result.rowCount); 1492 result.close(); 1493 1494 let predicates4 = new dataRdb.RdbPredicates("AllDataType"); 1495 predicates4.notBetween("longValue", 0, Number.MAX_VALUE); 1496 result = await rdbStore.query(predicates4); 1497 expect(1).assertEqual(result.rowCount); 1498 result.close(); 1499 1500 let predicates5 = new dataRdb.RdbPredicates("AllDataType"); 1501 predicates5.notBetween("longValue", Number.NEGATIVE_INFINITY, 0); 1502 result = await rdbStore.query(predicates5); 1503 expect(2).assertEqual(result.rowCount); 1504 result.close(); 1505 1506 let predicates6 = new dataRdb.RdbPredicates("AllDataType"); 1507 predicates6.notBetween("longValue", 0, Number.POSITIVE_INFINITY); 1508 result = await rdbStore.query(predicates6); 1509 expect(1).assertEqual(result.rowCount); 1510 result.close(); 1511 result = null 1512 1513 done(); 1514 console.log(TAG + "************* testNotBetween0005 end *************"); 1515 }) 1516 1517 /** 1518 * @tc.name testGlob0001 1519 * @tc.number I4JWCV 1520 * @tc.desc end with ? by glob. 1521 */ 1522 it('testGlob0001', 0, async function (done) { 1523 console.log(TAG + "************* testGlob0001 start *************"); 1524 1525 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1526 predicates.glob("stringValue", "ABC*"); 1527 let result = await rdbStore.query(predicates); 1528 expect(3).assertEqual(result.rowCount); 1529 result.close(); 1530 result = null 1531 1532 done(); 1533 console.log(TAG + "************* testGlob0001 end *************"); 1534 }) 1535 1536 /** 1537 * @tc.name testGlob0002 1538 * @tc.number I4JWCV 1539 * @tc.desc begin with * by glob. 1540 */ 1541 it('testGlob0002', 0, async function (done) { 1542 console.log(TAG + "************* testGlob0002 start *************"); 1543 1544 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1545 predicates.glob("stringValue", "*LMN"); 1546 let result = await rdbStore.query(predicates); 1547 expect(3).assertEqual(result.rowCount); 1548 result.close(); 1549 result = null 1550 1551 done(); 1552 console.log(TAG + "************* testGlob0002 end *************"); 1553 }) 1554 1555 /** 1556 * @tc.name testGlob0003 1557 * @tc.number I4JWCV 1558 * @tc.desc end with ? by glob. 1559 */ 1560 it('testGlob0003', 0, async function (done) { 1561 console.log(TAG + "************* testGlob0003 start *************"); 1562 1563 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1564 predicates.glob("stringValue", "ABCDEFGHIJKLM?"); 1565 let result = await rdbStore.query(predicates); 1566 expect(3).assertEqual(result.rowCount); 1567 result.close(); 1568 result = null 1569 1570 done(); 1571 console.log(TAG + "************* testGlob0003 end *************"); 1572 }) 1573 1574 /** 1575 * @tc.name testGlob0004 1576 * @tc.number I4JWCV 1577 * @tc.desc begin with ? by glob. 1578 */ 1579 it('testGlob0004', 0, async function (done) { 1580 console.log(TAG + "************* testGlob0004 start *************"); 1581 1582 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1583 predicates.glob("stringValue", "?BCDEFGHIJKLMN"); 1584 let result = await rdbStore.query(predicates); 1585 expect(3).assertEqual(result.rowCount); 1586 result.close(); 1587 result = null 1588 1589 done(); 1590 console.log(TAG + "************* testGlob0004 end *************"); 1591 }) 1592 1593 /** 1594 * @tc.name testGlob0005 1595 * @tc.number I4JWCV 1596 * @tc.desc begin and end with * by glob. 1597 */ 1598 it('testGlob0005', 0, async function (done) { 1599 console.log(TAG + "************* testGlob0005 start *************"); 1600 1601 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1602 predicates.glob("stringValue", "*FGHI*"); 1603 let result = await rdbStore.query(predicates); 1604 expect(3).assertEqual(result.rowCount); 1605 result.close(); 1606 result = null 1607 1608 done(); 1609 console.log(TAG + "************* testGlob0005 end *************"); 1610 }) 1611 1612 /** 1613 * @tc.name testGlob0006 1614 * @tc.number I4JWCV 1615 * @tc.desc begin and end with ? by glob. 1616 */ 1617 it('testGlob0006', 0, async function (done) { 1618 console.log(TAG + "************* testGlob0006 start *************"); 1619 1620 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1621 predicates.glob("stringValue", "?BCDEFGHIJKLM?"); 1622 let result = await rdbStore.query(predicates); 1623 expect(3).assertEqual(result.rowCount); 1624 result.close(); 1625 result = null 1626 1627 done(); 1628 console.log(TAG + "************* testGlob0006 end *************"); 1629 }) 1630 1631 /** 1632 * @tc.name predicates contains normal test 1633 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0100 1634 * @tc.desc predicates contains normal test 1635 */ 1636 it('testContains0001', 0, async function (done) { 1637 console.log(TAG + "************* testContains0001 start *************"); 1638 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1639 predicates.contains("stringValue", "DEF"); 1640 let result = await rdbStore.query(predicates); 1641 expect(3).assertEqual(result.rowCount); 1642 result.close() 1643 result = null 1644 done(); 1645 console.log(TAG + "************* testContains0001 end *************"); 1646 }) 1647 1648 /** 1649 * @tc.name predicates contains normal test 1650 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0101 1651 * @tc.desc predicates contains normal test 1652 */ 1653 it('testContains0002', 0, async function (done) { 1654 console.log(TAG + "************* testContains0002 start *************"); 1655 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1656 predicates.contains("stringValue", "DEFX"); 1657 let result = await rdbStore.query(predicates); 1658 expect(0).assertEqual(result.rowCount); 1659 result.close() 1660 result = null 1661 done(); 1662 console.log(TAG + "************* testContains0002 end *************"); 1663 }) 1664 1665 /** 1666 * @tc.name predicates contains normal test 1667 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0102 1668 * @tc.desc predicates contains normal test 1669 */ 1670 it('testContains0003', 0, async function (done) { 1671 console.log(TAG + "************* testContains0003 start *************"); 1672 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1673 predicates.contains("characterValue", "中"); 1674 let result = await rdbStore.query(predicates); 1675 expect(1).assertEqual(result.rowCount); 1676 result.close() 1677 result = null 1678 done(); 1679 console.log(TAG + "************* testContains0003 end *************"); 1680 }) 1681 1682 /** 1683 * @tc.name predicates contains normal test 1684 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0103 1685 * @tc.desc predicates contains normal test 1686 */ 1687 it('testContains0004', 0, async function (done) { 1688 console.log(TAG + "************* testContains0004 start *************"); 1689 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1690 predicates.contains("characterValue", "#"); 1691 let result = await rdbStore.query(predicates); 1692 expect(1).assertEqual(result.rowCount); 1693 result.close() 1694 result = null 1695 done(); 1696 console.log(TAG + "************* testContains0004 end *************"); 1697 }) 1698 1699 /** 1700 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0104 1701 * @tc.name predicates contains abnormal test 1702 * @tc.desc 1.predicates contains abnormal "null" test 1703 * 2.predicates contains abnormal "undefined" test 1704 */ 1705 it('testContains0005', 0, async function (done) { 1706 console.log(TAG + "************* testContains0005 start *************"); 1707 1708 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 1709 predicates1.contains("characterValue", null); 1710 let result1 = await rdbStore.query(predicates1); 1711 expect(3).assertEqual(result1.rowCount); 1712 result1.close() 1713 result1 = null 1714 1715 1716 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 1717 predicates2.contains("characterValue", undefined); 1718 let result2 = await rdbStore.query(predicates2); 1719 expect(3).assertEqual(result2.rowCount); 1720 result2.close() 1721 result2 = null 1722 1723 done(); 1724 console.log(TAG + "************* testContains0005 end *************"); 1725 }) 1726 1727 /** 1728 * @tc.name predicates beginsWith normal test 1729 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0110 1730 * @tc.desc predicates beginsWith normal test 1731 */ 1732 it('testBeginsWith0001', 0, async function (done) { 1733 console.log(TAG + "************* testBeginsWith0001 start *************"); 1734 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1735 predicates.beginsWith("stringValue", "ABC"); 1736 let result = await rdbStore.query(predicates); 1737 expect(3).assertEqual(result.rowCount); 1738 result.close() 1739 result = null 1740 done(); 1741 console.log(TAG + "************* testBeginsWith0001 end *************"); 1742 }) 1743 1744 /** 1745 * @tc.name predicates beginsWith normal test 1746 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0111 1747 * @tc.desc predicates beginsWith normal test 1748 */ 1749 it('testBeginsWith0002', 0, async function (done) { 1750 console.log(TAG + "************* testBeginsWith0002 start *************"); 1751 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1752 predicates.beginsWith("stringValue", "ABCX"); 1753 let result = await rdbStore.query(predicates); 1754 expect(0).assertEqual(result.rowCount); 1755 result.close() 1756 result = null 1757 done(); 1758 console.log(TAG + "************* testBeginsWith0002 end *************"); 1759 }) 1760 1761 /** 1762 * @tc.name predicates beginsWith normal test 1763 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0112 1764 * @tc.desc predicates beginsWith normal test 1765 */ 1766 it('testBeginsWith0003', 0, async function (done) { 1767 console.log(TAG + "************* testBeginsWith0003 start *************"); 1768 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1769 predicates.beginsWith("characterValue", "中"); 1770 let result = await rdbStore.query(predicates); 1771 expect(1).assertEqual(result.rowCount); 1772 result.close() 1773 result = null 1774 done(); 1775 console.log(TAG + "************* testBeginsWith0003 end *************"); 1776 }) 1777 1778 /** 1779 * @tc.name predicates beginsWith normal test 1780 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0113 1781 * @tc.desc predicates beginsWith normal test 1782 */ 1783 it('testBeginsWith0004', 0, async function (done) { 1784 console.log(TAG + "************* testBeginsWith0004 start *************"); 1785 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1786 predicates.beginsWith("characterValue", "#"); 1787 let result = await rdbStore.query(predicates); 1788 expect(1).assertEqual(result.rowCount); 1789 result.close() 1790 result = null 1791 done(); 1792 console.log(TAG + "************* testBeginsWith0004 end *************"); 1793 }) 1794 1795 /** 1796 * @tc.name predicates endsWith normal test 1797 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0120 1798 * @tc.desc predicates endsWith normal test 1799 */ 1800 it('testEndsWith0001', 0, async function (done) { 1801 console.log(TAG + "************* testEndsWith0001 start *************"); 1802 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1803 predicates.endsWith("stringValue", "LMN"); 1804 let result = await rdbStore.query(predicates); 1805 expect(3).assertEqual(result.rowCount); 1806 result.close() 1807 result = null 1808 done(); 1809 console.log(TAG + "************* testEndsWith0001 end *************"); 1810 }) 1811 1812 /** 1813 * @tc.name predicates endsWith normal test 1814 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0121 1815 * @tc.desc predicates endsWith normal test 1816 */ 1817 it('testEndsWith0002', 0, async function (done) { 1818 console.log(TAG + "************* testEndsWith0002 start *************"); 1819 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1820 predicates.endsWith("stringValue", "LMNX"); 1821 let result = await rdbStore.query(predicates); 1822 expect(0).assertEqual(result.rowCount); 1823 result.close() 1824 result = null 1825 done(); 1826 console.log(TAG + "************* testEndsWith0002 end *************"); 1827 }) 1828 1829 /** 1830 * @tc.name predicates endsWith normal test 1831 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0122 1832 * @tc.desc predicates endsWith normal test 1833 */ 1834 it('testEndsWith0003', 0, async function (done) { 1835 console.log(TAG + "************* testEndsWith0003 start *************"); 1836 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1837 predicates.endsWith("characterValue", "中"); 1838 let result = await rdbStore.query(predicates); 1839 expect(1).assertEqual(result.rowCount); 1840 result.close() 1841 result = null 1842 done(); 1843 console.log(TAG + "************* testEndsWith0003 end *************"); 1844 }) 1845 1846 /** 1847 * @tc.name predicates endsWith normal test 1848 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0123 1849 * @tc.desc predicates endsWith normal test 1850 */ 1851 it('testEndsWith0004', 0, async function (done) { 1852 console.log(TAG + "************* testEndsWith0004 start *************"); 1853 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1854 predicates.endsWith("characterValue", "#"); 1855 let result = await rdbStore.query(predicates); 1856 expect(1).assertEqual(result.rowCount); 1857 result.close() 1858 result = null 1859 done(); 1860 console.log(TAG + "************* testEndsWith0004 end *************"); 1861 }) 1862 1863 /** 1864 * @tc.name predicates like normal test 1865 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0130 1866 * @tc.desc predicates like normal test 1867 */ 1868 it('testLike0001', 0, async function (done) { 1869 console.log(TAG + "************* testLike0001 start *************"); 1870 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1871 predicates.like("stringValue", "%LMN%"); 1872 let result = await rdbStore.query(predicates); 1873 expect(3).assertEqual(result.rowCount); 1874 result.close() 1875 result = null 1876 done(); 1877 console.log(TAG + "************* testLike0001 end *************"); 1878 }) 1879 1880 /** 1881 * @tc.name predicates like normal test 1882 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0130 1883 * @tc.desc predicates like normal test 1884 */ 1885 it('testLike0002', 0, async function (done) { 1886 console.log(TAG + "************* testLike0002 start *************"); 1887 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1888 predicates.like("stringValue", "%LMNX%"); 1889 let result = await rdbStore.query(predicates); 1890 expect(0).assertEqual(result.rowCount); 1891 result.close() 1892 result = null 1893 done(); 1894 console.log(TAG + "************* testLike0002 end *************"); 1895 }) 1896 1897 /** 1898 * @tc.name predicates like normal test 1899 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0132 1900 * @tc.desc predicates like normal test 1901 */ 1902 it('testLike0003', 0, async function (done) { 1903 console.log(TAG + "************* testLike0003 start *************"); 1904 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1905 predicates.like("characterValue", "%中%"); 1906 let result = await rdbStore.query(predicates); 1907 expect(1).assertEqual(result.rowCount); 1908 result.close() 1909 result = null 1910 done(); 1911 console.log(TAG + "************* testLike0003 end *************"); 1912 }) 1913 1914 /** 1915 * @tc.name predicates like normal test 1916 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0133 1917 * @tc.desc predicates like normal test 1918 */ 1919 it('testLike0004', 0, async function (done) { 1920 console.log(TAG + "************* testLike0004 start *************"); 1921 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1922 predicates.like("characterValue", "%#%"); 1923 let result = await rdbStore.query(predicates); 1924 expect(1).assertEqual(result.rowCount); 1925 result.close() 1926 result = null 1927 done(); 1928 console.log(TAG + "************* testLike0004 end *************"); 1929 }) 1930 1931 /** 1932 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0133 1933 * @tc.name predicates like abnormal test 1934 * @tc.desc 1.predicates like abnormal "null" test 1935 * 2.predicates like abnormal "undefined" test 1936 */ 1937 it('testLike0005', 0, async function (done) { 1938 console.log(TAG + "************* testLike0005 start *************"); 1939 1940 let predicates1 = new dataRdb.RdbPredicates("AllDataType"); 1941 predicates1.like("characterValue", null); 1942 let result1 = await rdbStore.query(predicates1); 1943 expect(3).assertEqual(result1.rowCount); 1944 result1.close() 1945 result1 = null 1946 1947 let predicates2 = new dataRdb.RdbPredicates("AllDataType"); 1948 predicates2.like("characterValue", undefined); 1949 let result2 = await rdbStore.query(predicates2); 1950 expect(3).assertEqual(result2.rowCount); 1951 result2.close() 1952 result2 = null 1953 1954 done(); 1955 console.log(TAG + "************* testLike0005 end *************"); 1956 }) 1957 1958 1959 /** 1960 * @tc.name predicates beginWrap normal test 1961 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0140 1962 * @tc.desc predicates beginWrap normal test 1963 */ 1964 it('testBeginWrap0001', 0, async function (done) { 1965 console.log(TAG + "************* testBeginWrap0001 start *************"); 1966 1967 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1968 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 1969 .beginWrap() 1970 .equalTo("integerValue", 1) 1971 .or() 1972 .equalTo("integerValue", 2147483647) 1973 .endWrap(); 1974 let result = await rdbStore.query(predicates); 1975 expect(2).assertEqual(result.rowCount); 1976 result.close() 1977 result = null 1978 1979 done(); 1980 console.log(TAG + "************* testBeginWrap0001 end *************"); 1981 }) 1982 1983 /** 1984 * @tc.name predicates beginWrap normal test 1985 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0141 1986 * @tc.desc predicates beginWrap normal test 1987 */ 1988 it('testBeginWrap0002', 0, async function (done) { 1989 console.log(TAG + "************* testBeginWrap0002 start *************"); 1990 1991 let predicates = new dataRdb.RdbPredicates("AllDataType"); 1992 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 1993 .beginWrap() 1994 .equalTo("characterValue", ' ') 1995 .endWrap(); 1996 let result = await rdbStore.query(predicates); 1997 expect(1).assertEqual(result.rowCount); 1998 result.close() 1999 result = null 2000 2001 done(); 2002 console.log(TAG + "************* testBeginWrap0002 end *************"); 2003 }) 2004 2005 /** 2006 * @tc.name predicates beginWrap normal test 2007 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0142 2008 * @tc.desc predicates beginWrap normal test 2009 */ 2010 it('testBeginWrap0003', 0, async function (done) { 2011 console.log(TAG + "************* testBeginWrap0003 start *************"); 2012 2013 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2014 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 2015 .beginWrap() 2016 .equalTo("characterValue", '中') 2017 .endWrap(); 2018 let result = await rdbStore.query(predicates); 2019 expect(1).assertEqual(result.rowCount); 2020 result = null 2021 2022 done(); 2023 console.log(TAG + "************* testBeginWrap0003 end *************"); 2024 }) 2025 2026 /** 2027 * @tc.name predicates beginWrap normal test 2028 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0143 2029 * @tc.desc predicates beginWrap normal test 2030 */ 2031 it('testBeginWrap0004', 0, async function (done) { 2032 console.log(TAG + "************* testBeginWrap0004 start *************"); 2033 2034 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2035 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 2036 .equalTo("characterValue", '中') 2037 .endWrap(); 2038 let result = await rdbStore.query(predicates); 2039 expect(-1).assertEqual(result.rowCount); 2040 result.close() 2041 result = null 2042 2043 done(); 2044 console.log(TAG + "************* testBeginWrap0004 end *************"); 2045 }) 2046 2047 /** 2048 * @tc.name predicates beginWrap normal test 2049 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0144 2050 * @tc.desc predicates beginWrap normal test 2051 */ 2052 it('testBeginWrap0005', 0, async function (done) { 2053 console.log(TAG + "************* testBeginWrap0005 start *************"); 2054 { 2055 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2056 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 2057 .beginWrap() 2058 .equalTo("characterValue", '中'); 2059 let result = await rdbStore.query(predicates); 2060 expect(-1).assertEqual(result.rowCount); 2061 result.close() 2062 result = null 2063 } 2064 done(); 2065 console.log(TAG + "************* testBeginWrap0005 end *************"); 2066 }) 2067 2068 /** 2069 * @tc.name predicates and normal test 2070 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0150 2071 * @tc.desc predicates and normal test 2072 */ 2073 it('testAnd0001', 0, async function (done) { 2074 console.log(TAG + "************* testAnd0001 start *************"); 2075 2076 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2077 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 2078 .and() 2079 .equalTo("integerValue", 1); 2080 let result = await rdbStore.query(predicates); 2081 expect(1).assertEqual(result.rowCount); 2082 result.close() 2083 result = null 2084 2085 done(); 2086 console.log(TAG + "************* testAnd0001 end *************"); 2087 }) 2088 2089 /** 2090 * @tc.name predicates or normal test 2091 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0151 2092 * @tc.desc predicates or normal test 2093 */ 2094 it('testAnd0002', 0, async function (done) { 2095 console.log(TAG + "************* testAnd0002 start *************"); 2096 2097 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2098 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN") 2099 .beginWrap() 2100 .equalTo("integerValue", 1) 2101 .or() 2102 .equalTo("integerValue", 2147483647) 2103 .endWrap(); 2104 let result = await rdbStore.query(predicates); 2105 expect(2).assertEqual(result.rowCount); 2106 result.close() 2107 result = null 2108 2109 done(); 2110 console.log(TAG + "************* testAnd0002 end *************"); 2111 }) 2112 2113 /** 2114 * @tc.name predicates and normal test 2115 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0152 2116 * @tc.desc predicates and normal test 2117 */ 2118 it('testAnd0003', 0, async function (done) { 2119 console.log(TAG + "************* testAnd0003 start *************"); 2120 2121 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2122 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1); 2123 console.log(TAG + "you should not start a request" + " with \"and\" or use or() before this function"); 2124 2125 done(); 2126 console.log(TAG + "************* testAnd0003 end *************"); 2127 }) 2128 2129 /** 2130 * @tc.name predicates order normal test 2131 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0160 2132 * @tc.desc predicates order normal test 2133 */ 2134 it('testOrder0001', 0, async function (done) { 2135 console.log(TAG + "************* testOrder0001 start *************"); 2136 2137 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2138 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByAsc("integerValue").distinct(); 2139 let result = await rdbStore.query(predicates); 2140 expect(3).assertEqual(result.rowCount); 2141 expect(true).assertEqual(result.goToFirstRow()) 2142 expect(3).assertEqual(result.getLong(0)); 2143 expect(true).assertEqual(result.goToNextRow()) 2144 expect(2).assertEqual(result.getLong(0)); 2145 expect(true).assertEqual(result.goToNextRow()) 2146 expect(1).assertEqual(result.getLong(0)); 2147 result.close() 2148 result = null 2149 2150 done(); 2151 console.log(TAG + "************* testOrder0001 end *************"); 2152 }) 2153 2154 /** 2155 * @tc.name predicates order normal test 2156 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0161 2157 * @tc.desc predicates order normal test 2158 */ 2159 it('testOrder0002', 0, async function (done) { 2160 console.log(TAG + "************* testOrder0002 start *************"); 2161 2162 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2163 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByDesc("integerValue").distinct(); 2164 let result = await rdbStore.query(predicates); 2165 expect(3).assertEqual(result.rowCount); 2166 expect(true).assertEqual(result.goToFirstRow()) 2167 expect(1).assertEqual(result.getLong(0)); 2168 expect(true).assertEqual(result.goToNextRow()) 2169 expect(2).assertEqual(result.getLong(0)); 2170 expect(true).assertEqual(result.goToNextRow()) 2171 expect(3).assertEqual(result.getLong(0)); 2172 result.close() 2173 result = null 2174 2175 done(); 2176 console.log(TAG + "************* testOrder0002 end *************"); 2177 }) 2178 2179 /** 2180 * @tc.name predicates order normal test 2181 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0162 2182 * @tc.desc predicates order normal test 2183 */ 2184 it('testOrder0003', 0, async function (done) { 2185 console.log(TAG + "************* testOrder0003 start *************"); 2186 2187 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2188 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByDesc("integerValueX").distinct(); 2189 let result = await rdbStore.query(predicates); 2190 expect(-1).assertEqual(result.rowCount); 2191 result.close() 2192 result = null 2193 2194 done(); 2195 console.log(TAG + "************* testOrder0003 end *************"); 2196 }) 2197 2198 /** 2199 * @tc.name predicates order normal test 2200 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0163 2201 * @tc.desc predicates order normal test 2202 */ 2203 it('testOrder0004', 0, async function (done) { 2204 console.log(TAG + "************* testOrder0004 start *************"); 2205 2206 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2207 predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").orderByAsc("integerValueX").distinct(); 2208 let result = await rdbStore.query(predicates); 2209 expect(-1).assertEqual(result.rowCount); 2210 result.close() 2211 result = null 2212 2213 done(); 2214 console.log(TAG + "************* testOrder0004 end *************"); 2215 }) 2216 2217 /** 2218 * @tc.name predicates limit normal test 2219 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0170 2220 * @tc.desc predicates limit normal test 2221 */ 2222 it('testLimit0001', 0, async function (done) { 2223 console.log(TAG + "************* testLimit0001 start *************"); 2224 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2225 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(1); 2226 let result = await rdbStore.query(predicates); 2227 expect(1).assertEqual(result.rowCount); 2228 result.close() 2229 result = null 2230 done(); 2231 console.log(TAG + "************* testLimit0001 end *************"); 2232 }) 2233 2234 /** 2235 * @tc.name predicates limit normal test 2236 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0171 2237 * @tc.desc predicates limit normal test 2238 */ 2239 it('testLimit0002', 0, async function (done) { 2240 console.log(TAG + "************* testLimit0002 start *************"); 2241 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2242 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3); 2243 let result = await rdbStore.query(predicates); 2244 expect(3).assertEqual(result.rowCount); 2245 result.close() 2246 result = null 2247 done(); 2248 console.log(TAG + "************* testLimit0002 end *************"); 2249 }) 2250 2251 /** 2252 * @tc.name predicates limit normal test 2253 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0172 2254 * @tc.desc predicates limit normal test 2255 */ 2256 it('testLimit0003', 0, async function (done) { 2257 console.log(TAG + "************* testLimit0003 start *************"); 2258 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2259 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(100); 2260 let result = await rdbStore.query(predicates); 2261 expect(3).assertEqual(result.rowCount); 2262 result.close() 2263 result = null 2264 done(); 2265 console.log(TAG + "************* testLimit0003 end *************"); 2266 }) 2267 2268 /** 2269 * @tc.name predicates limit normal test 2270 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0173 2271 * @tc.desc predicates limit normal test 2272 */ 2273 it('testLimit0004', 0, async function (done) { 2274 console.log(TAG + "************* testLimit0004 start *************"); 2275 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2276 predicates.like("stringValue", "中").limitAs(1); 2277 let result = await rdbStore.query(predicates); 2278 expect(0).assertEqual(result.rowCount); 2279 result.close() 2280 result = null 2281 done(); 2282 console.log(TAG + "************* testLimit0004 end *************"); 2283 }) 2284 2285 /** 2286 * @tc.name predicates limit normal test 2287 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0174 2288 * @tc.desc predicates limit normal test 2289 */ 2290 it('testLimit0005', 0, async function (done) { 2291 console.log(TAG + "************* testLimit0005 start *************"); 2292 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2293 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(0); 2294 let result = await rdbStore.query(predicates); 2295 expect(3).assertEqual(result.rowCount); 2296 result.close() 2297 result = null 2298 done(); 2299 console.log(TAG + "************* testLimit0005 end *************"); 2300 }) 2301 2302 /** 2303 * @tc.name predicates limit normal test 2304 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0175 2305 * @tc.desc predicates limit normal test 2306 */ 2307 it('testLimit0006', 0, async function (done) { 2308 console.log(TAG + "************* testLimit0006 start *************"); 2309 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2310 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(-1); 2311 let result = await rdbStore.query(predicates); 2312 expect(3).assertEqual(result.rowCount); 2313 result.close() 2314 result = null 2315 done(); 2316 console.log(TAG + "************* testLimit0006 end *************"); 2317 }) 2318 2319 /** 2320 * @tc.name predicates offset normal test 2321 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0180 2322 * @tc.desc predicates offset normal test 2323 */ 2324 it('testOffset0001', 0, async function (done) { 2325 console.log(TAG + "************* testOffset0001 start *************"); 2326 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2327 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(1); 2328 let result = await rdbStore.query(predicates); 2329 expect(2).assertEqual(result.rowCount); 2330 result.close() 2331 result = null 2332 done(); 2333 console.log(TAG + "************* testOffset0001 end *************"); 2334 }) 2335 2336 /** 2337 * @tc.name predicates offset normal test 2338 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0181 2339 * @tc.desc predicates offset normal test 2340 */ 2341 it('testOffset0002', 0, async function (done) { 2342 console.log(TAG + "************* testOffset0002 start *************"); 2343 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2344 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(0); 2345 let result = await rdbStore.query(predicates); 2346 expect(3).assertEqual(result.rowCount); 2347 result.close() 2348 result = null 2349 done(); 2350 console.log(TAG + "************* testOffset0002 end *************"); 2351 }) 2352 2353 /** 2354 * @tc.name predicates offset normal test 2355 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0182 2356 * @tc.desc predicates offset normal test 2357 */ 2358 it('testOffset0003', 0, async function (done) { 2359 console.log(TAG + "************* testOffset0003 start *************"); 2360 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2361 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(5); 2362 let result = await rdbStore.query(predicates); 2363 expect(0).assertEqual(result.rowCount); 2364 result.close() 2365 result = null 2366 done(); 2367 console.log(TAG + "************* testOffset0003 end *************"); 2368 }) 2369 2370 /** 2371 * @tc.name predicates offset normal test 2372 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0183 2373 * @tc.desc predicates offset normal test 2374 */ 2375 it('testOffset0004', 0, async function (done) { 2376 console.log(TAG + "************* testOffset0004 start *************"); 2377 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2378 predicates.like("stringValue", "ABCDEFGHIJKLMN").limitAs(3).offsetAs(-1); 2379 let result = await rdbStore.query(predicates); 2380 expect(3).assertEqual(result.rowCount); 2381 result.close() 2382 result = null 2383 done(); 2384 console.log(TAG + "************* testOffset0004 end *************"); 2385 }) 2386 2387 /** 2388 * @tc.name predicates in normal test 2389 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0190 2390 * @tc.desc predicates in normal test 2391 */ 2392 it('testIn0001', 0, async function (done) { 2393 console.log(TAG + "************* testIn0001 start *************"); 2394 var values = [Number.MIN_VALUE.toString()]; 2395 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2396 predicates.in("doubleValue", values); 2397 let result = await rdbStore.query(predicates); 2398 expect(1).assertEqual(result.rowCount); 2399 result.close() 2400 done(); 2401 console.log(TAG + "************* testIn0001 end *************"); 2402 }) 2403 2404 /** 2405 * @tc.name predicates in normal test 2406 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0191 2407 * @tc.desc predicates in normal test 2408 */ 2409 it('testIn0002', 0, async function (done) { 2410 console.log(TAG + "************* testIn0002 start *************"); 2411 var values = ["1.0"]; 2412 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2413 predicates.in("doubleValue", values); 2414 let result = await rdbStore.query(predicates); 2415 expect(1).assertEqual(result.rowCount); 2416 result.close() 2417 done(); 2418 console.log(TAG + "************* testIn0002 end *************"); 2419 }) 2420 2421 /** 2422 * @tc.name predicates in normal test 2423 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0192 2424 * @tc.desc predicates in normal test 2425 */ 2426 it('testIn0003', 0, async function (done) { 2427 console.log(TAG + "************* testIn0003 start *************"); 2428 var values = [DOUBLE_MAX.toString()]; 2429 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2430 predicates.in("doubleValue", values); 2431 let result = await rdbStore.query(predicates); 2432 expect(1).assertEqual(result.rowCount); 2433 result.close() 2434 done(); 2435 console.log(TAG + "************* testIn0003 end *************"); 2436 }) 2437 2438 /** 2439 * @tc.name predicates in normal test 2440 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0193 2441 * @tc.desc predicates in normal test 2442 */ 2443 it('testIn0004', 0, async function (done) { 2444 console.log(TAG + "************* testIn0004 start *************"); 2445 var values = [Number.MIN_VALUE.toString(), "1.0", DOUBLE_MAX.toString()]; 2446 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2447 predicates.in("doubleValue", values); 2448 let result = await rdbStore.query(predicates); 2449 expect(3).assertEqual(result.rowCount); 2450 result.close() 2451 done(); 2452 console.log(TAG + "************* testIn0004 end *************"); 2453 }) 2454 2455 /** 2456 * @tc.name predicates in normal test 2457 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0194 2458 * @tc.desc predicates in normal test 2459 */ 2460 it('testIn0005', 0, async function (done) { 2461 console.log(TAG + "************* testIn0005 start *************"); 2462 var values = []; 2463 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2464 predicates.in("doubleValue", values); 2465 let result = await rdbStore.query(predicates); 2466 expect(3).assertEqual(result.rowCount); 2467 result.close() 2468 done(); 2469 console.log(TAG + "************* testIn0005 end *************"); 2470 }) 2471 2472 /** 2473 * @tc.name testNotIn0001 2474 * @tc.number I4JWCV 2475 * @tc.desc the common and min value test with notin. 2476 */ 2477 it('testNotIn0001', 0, async function (done) { 2478 console.log(TAG + "************* testNotIn0001 start *************"); 2479 var values = [1, -2147483648]; 2480 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2481 predicates.notIn("integerValue", values); 2482 let result = await rdbStore.query(predicates); 2483 expect(1).assertEqual(result.rowCount); 2484 result.close(); 2485 done(); 2486 console.log(TAG + "************* testNotIn0001 end *************"); 2487 }) 2488 2489 /** 2490 * @tc.name testNotIn0002 2491 * @tc.number I4JWCV 2492 * @tc.desc the common and max value test with notin. 2493 */ 2494 it('testNotIn0002', 0, async function (done) { 2495 console.log(TAG + "************* testNotIn0002 start *************"); 2496 let values = [1, 2147483647]; 2497 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2498 predicates.notIn("integerValue", values); 2499 let result = await rdbStore.query(predicates); 2500 expect(1).assertEqual(result.rowCount); 2501 result.close(); 2502 done(); 2503 console.log(TAG + "************* testNotIn0002 end *************"); 2504 }) 2505 2506 /** 2507 * @tc.name testNotIn0003 2508 * @tc.number I4JWCV 2509 * @tc.desc the min and max value test with notin. 2510 */ 2511 it('testNotIn0003', 0, async function (done) { 2512 console.log(TAG + "************* testNotIn0003 start *************"); 2513 var values = [-2147483648, 2147483647]; 2514 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2515 predicates.notIn("integerValue", values); 2516 let result = await rdbStore.query(predicates); 2517 expect(1).assertEqual(result.rowCount); 2518 result.close(); 2519 done(); 2520 console.log(TAG + "************* testNotIn0003 end *************"); 2521 }) 2522 2523 /** 2524 * @tc.name testNotIn0004 2525 * @tc.number I4JWCV 2526 * @tc.desc the min and max value test with notin. 2527 */ 2528 it('testNotIn0004', 0, async function (done) { 2529 console.log(TAG + "************* testNotIn0004 start *************"); 2530 var values = []; 2531 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2532 predicates.notIn("integerValue", values); 2533 let result = await rdbStore.query(predicates); 2534 expect(3).assertEqual(result.rowCount); 2535 result.close(); 2536 done(); 2537 console.log(TAG + "************* testNotIn0004 end *************"); 2538 }) 2539 2540 /** 2541 * @tc.name predicates constructor test 2542 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0200 2543 * @tc.desc predicates constructor test 2544 */ 2545 it('testCreate0001', 0, async function (done) { 2546 console.log(TAG + "************* testCreate0001 start *************"); 2547 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2548 let result = await rdbStore.query(predicates); 2549 expect(3).assertEqual(result.rowCount); 2550 result.close() 2551 done(); 2552 console.log(TAG + "************* testCreate0001 end *************"); 2553 }) 2554 2555 /** 2556 * @tc.name predicates constructor test 2557 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0201 2558 * @tc.desc predicates constructor test 2559 */ 2560 it('testCreate0002', 0, async function (done) { 2561 console.log(TAG + "************* testCreate0002 start *************"); 2562 let predicates = new dataRdb.RdbPredicates("test"); 2563 let result = await rdbStore.query(predicates); 2564 expect(-1).assertEqual(result.rowCount); 2565 result.close() 2566 done(); 2567 console.log(TAG + "************* testCreate0002 end *************"); 2568 }) 2569 2570 /** 2571 * @tc.name predicates groupBy test 2572 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0210 2573 * @tc.desc predicates groupBy test 2574 */ 2575 it('testGroupBy0001', 0, async function (done) { 2576 console.log(TAG + "************* testGroupBy0001 start *************"); 2577 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2578 predicates.like("stringValue", "ABCDEFGHIJKLMN").groupBy(["characterValue"]); 2579 let result = await rdbStore.query(predicates); 2580 expect(3).assertEqual(result.rowCount); 2581 result.close() 2582 result = null 2583 done(); 2584 console.log(TAG + "************* testGroupBy0001 end *************"); 2585 }) 2586 2587 /** 2588 * @tc.name predicates groupBy test 2589 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0211 2590 * @tc.desc predicates groupBy test 2591 */ 2592 it('testGroupBy0002', 0, async function (done) { 2593 console.log(TAG + "************* testGroupBy0002 start *************"); 2594 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2595 predicates.like("stringValue", "ABCDEFGHIJKLMN").groupBy(["characterValueX"]); 2596 let result = await rdbStore.query(predicates); 2597 expect(-1).assertEqual(result.rowCount); 2598 result.close() 2599 result = null 2600 done(); 2601 console.log(TAG + "************* testGroupBy0002 end *************"); 2602 }) 2603 2604 /** 2605 * @tc.name predicates indexedBy test 2606 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0220 2607 * @tc.desc predicates indexedBy test 2608 */ 2609 it('testIndexedBy0001', 0, async function (done) { 2610 console.log(TAG + "************* testIndexedBy0001 start *************"); 2611 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2612 predicates.like("stringValue", "ABCDEFGHIJKLMN").indexedBy("characterValue"); 2613 let result = await rdbStore.query(predicates); 2614 //test table have no indexe column, so return -1 2615 expect(-1).assertEqual(result.rowCount); 2616 result.close() 2617 result = null 2618 done(); 2619 console.log(TAG + "************* testIndexedBy0001 end *************"); 2620 }) 2621 2622 /** 2623 * @tc.name predicates indexedBy test 2624 * @tc.number SUB_DDM_AppDataFWK_JSRDB_Predicates_0221 2625 * @tc.desc predicates indexedBy test 2626 */ 2627 it('testIndexedBy0002', 0, async function (done) { 2628 console.log(TAG + "************* testIndexedBy0002 start *************"); 2629 let predicates = new dataRdb.RdbPredicates("AllDataType"); 2630 try { 2631 predicates.like("stringValue", "ABCDEFGHIJKLMN").indexedBy(["characterValueX"]); 2632 let result = await rdbStore.query(predicates); 2633 expect(3).assertEqual(result.rowCount); 2634 result.close() 2635 result = null 2636 } catch (err) { 2637 console.log("catch err: failed, err: code=" + err.code + " message=" + err.message) 2638 expect("401").assertEqual(err.code) 2639 } 2640 done(); 2641 console.log(TAG + "************* testIndexedBy0002 end *************"); 2642 }) 2643 2644 console.log(TAG + "*************Unit Test End*************"); 2645})