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