提交 bc5abd0f 编写于 作者: S Shuduo Sang

add some test cases to test boundary which defined in inc/taosdef.h

[TD-221]
上级 36973a50
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
tdLog.info('=============== step1')
tdLog.info('create table tb (ts timestamp, speed binary(4089))')
tdSql.error('create table tb (ts timestamp, speed binary(4089))')
tdLog.info('create table tb (ts timestamp, speed binary(4088))')
tdSql.error('create table tb (ts timestamp, speed binary(4088))')
tdLog.info('create table tb (ts timestamp, speed binary(4084))')
tdSql.execute('create table tb (ts timestamp, speed binary(4084))')
tdLog.info("insert into tb values (now, ) -x step1")
tdSql.error("insert into tb values (now, )")
with open("../../README.md", "r") as inputFile:
data = inputFile.read(4084).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
tdLog.info("insert %d length data: %s" % (len(data), data))
tdLog.info("insert into tb values (now+2a, data)")
tdSql.execute("insert into tb values (now+2a, '%s')" % data)
tdLog.info('select speed from tb order by ts desc')
tdSql.query('select speed from tb order by ts desc')
tdLog.info('tdSql.checkRow(1)')
tdSql.checkRows(1)
tdLog.info('==> $data01')
tdLog.info("tdSql.checkData(0, 1, '%s')" % data)
tdSql.checkData(0, 1, data)
tdLog.info('create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))')
tdSql.execute('create table tb2 (ts timestamp, speed binary(2040), temp binary(2044))')
speed = inputFile.read(2044).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
temp = inputFile.read(2040).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
tdLog.info("insert into tb values (now+3a, speed, temp)")
tdSql.error("insert into tb values (now+3a, '%s', '%s')" % (speed, temp))
speed = inputFile.read(2040).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
temp = inputFile.read(2044).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
tdLog.info("insert into tb values (now+4a, speed, temp)")
tdSql.error("insert into tb values (now+4a, '%s', '%s')" % (speed, temp))
tdLog.info('tdSql.checkRow(2)')
tdSql.checkRows(2)
tdLog.info('==> $data11')
tdLog.info("tdSql.checkData(1, 1, '%s')" % speed)
tdSql.checkData(1, 1, speed)
tdLog.info('==> $data12')
tdLog.info("tdSql.checkData(1, 2, '%s')" % temp)
tdSql.checkData(1, 1, temp)
inputFile.close()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
tdSql.error('create table tb (ts timestamp, col nchar(1022))')
tdSql.execute('create table tb (ts timestamp, col nchar(1021))')
tdSql.execute("insert into tb values (now, 'taosdata')")
tdSql.query("select * from tb")
tdSql.checkRows(1)
tdSql.checkData(0, 1, 'taosdata')
with open("../../README.md", "r") as inputFile:
data = inputFile.read(1021).replace("\n", " ").replace("\\", " ").replace("\'", " ").replace("\"", " ").replace("[", " ").replace("]", " ").replace("!", " ")
tdLog.info("insert %d length data: %s" % (len(data), data))
tdSql.execute("insert into tb values (now, '%s')" % data)
tdSql.query("select * from tb")
tdSql.checkRows(2)
tdSql.checkData(1, 1, data)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
此差异已折叠。
# -*- coding: utf-8 -*-
import sys
import string
import random
from util.log import *
from util.cases import *
from util.sql import *
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
chars = string.ascii_uppercase+string.ascii_lowercase
tb_name = ''.join(random.choices(chars, k=192))
tdLog.info('tb_name length %d' % len(tb_name))
tdLog.info('create table %s (ts timestamp, value int)' % tb_name)
tdSql.error('create table %s (ts timestamp, speed binary(4089))' % tb_name)
tb_name = ''.join(random.choices(chars, k=191))
tdLog.info('tb_name length %d' % len(tb_name))
tdLog.info('create table %s (ts timestamp, value int)' % tb_name)
tdSql.execute('create table %s (ts timestamp, speed binary(4089))' % tb_name)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册