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