Exemple #1
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')
Exemple #2
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')
Exemple #3
0
def sdsnew_test1():
    sds_imp = SdsImp()
    s = sds_imp.sdsnew('hello')
    ensure(s.buf == 'hello' and s.len == 5, 'sds new test1')
Exemple #4
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')
Exemple #5
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')
Exemple #6
0
def sdslen_test2():
    sds_imp = SdsImp()
    s = sds_imp.sdsempty()
    l = sds_imp.sdslen(s)
    ensure(l == 0, 'sds len test2')
Exemple #7
0
def sdslen_test1():
    sds_imp = SdsImp()
    s = sds_imp.sdsnew('hello')
    l = sds_imp.sdslen(s)
    ensure(l == 5, 'sds len test1')
Exemple #8
0
def sdsnew_test2():
    sds_imp = SdsImp()
    s = sds_imp.sdsempty()
    ensure(s.buf == '' and s.len == 0, 'sds new test2')