Example #1
0
def aslistshift_test2():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    v = adlist_Imp.shift()
    ensure(v == "hello1", 'sdslist shift test2')
Example #2
0
def aslistshift_test1():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    adlist_Imp.shift()
    ensure(adlist_Imp.len == 2, 'sdslist shift test1')
Example #3
0
def aslistpop_test1():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    adlist_Imp.pop()
    ensure(adlist_Imp.len == 2, 'sdslist pop test1')
Example #4
0
def aslistpop_test2():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    v = adlist_Imp.pop()
    ensure(v == "hello3", 'sdslist pop test2')
Example #5
0
def aslistpush_test3():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    ensure(adlist_Imp.tail.prev.prev.value == "hello2", 'sdslist push test3')
Example #6
0
def sdscat_test1():
    sds_imp = SdsImp()
    s1 = sds_imp.sdsnew('hello')
    s2 = sds_imp.sdsnew(' world')
    s = sds_imp.sdscat(s1, s2)
    ensure(s.len == 11 and s.buf == 'hello world', 'sds concat test1')
Example #7
0
def aslistpush_test1():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    ensure(adlist_Imp.len == 3, 'sdslist push test1')
Example #8
0
def aslistpush_test2():
    adlist_Imp = AdlistImp()
    adlist_Imp.push('hello1')
    adlist_Imp.push('hello2')
    adlist_Imp.push('hello3')
    ensure(adlist_Imp.head.next.next.value == "hello2", 'sdslist push test2')
Example #9
0
def sdsnew_test1():
    sds_imp = SdsImp()
    s = sds_imp.sdsnew('hello')
    ensure(s.buf == 'hello' and s.len == 5, 'sds new test1')
Example #10
0
def sdscmp_test2():
    sds_imp = SdsImp()
    s1 = sds_imp.sdsnew('hello')
    s2 = sds_imp.sdsnew(' hello')
    s = sds_imp.sdscmp(s1, s2)
    ensure(s == False, 'sds cmp test2')
Example #11
0
def sdscat_test2():
    sds_imp = SdsImp()
    s1 = sds_imp.sdsnew('')
    s2 = sds_imp.sdsnew('')
    s = sds_imp.sdscat(s1, s2)
    ensure(s.len == 0 and s.buf == '', 'sds concat test2')
Example #12
0
def sdscmp_test1():
    sds_imp = SdsImp()
    s1 = sds_imp.sdsnew('hello')
    s2 = sds_imp.sdsnew('hello')
    s = sds_imp.sdscmp(s1, s2)
    ensure(s == True, 'sds cmp test1')
Example #13
0
def sdsnew_test2():
    sds_imp = SdsImp()
    s = sds_imp.sdsempty()
    ensure(s.buf == '' and s.len == 0, 'sds new test2')
Example #14
0
def sdslen_test2():
    sds_imp = SdsImp()
    s = sds_imp.sdsempty()
    l = sds_imp.sdslen(s)
    ensure(l == 0, 'sds len test2')
Example #15
0
def aslistunshift_test3():
    adlist_Imp = AdlistImp()
    adlist_Imp.unshift('hello1')
    adlist_Imp.unshift('hello2')
    adlist_Imp.unshift('hello3')
    ensure(adlist_Imp.head.next.next.value == "hello2", 'sdslist unshift test3')
Example #16
0
def sdslen_test1():
    sds_imp = SdsImp()
    s = sds_imp.sdsnew('hello')
    l = sds_imp.sdslen(s)
    ensure(l == 5, 'sds len test1')
Example #17
0
def aslistunshift_test1():
    adlist_Imp = AdlistImp()
    adlist_Imp.unshift('hello1')
    adlist_Imp.unshift('hello2')
    adlist_Imp.unshift('hello3')
    ensure(adlist_Imp.len == 3, 'sdslist unshift test1')