1
0

misc6.test 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # 2006 September 4
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. # This file implements regression tests for SQLite library.
  12. #
  13. # This file implements tests to make sure sqlite3_value_text()
  14. # always returns a null-terminated string.
  15. #
  16. # $Id: misc6.test,v 1.3 2007/04/23 23:56:32 drh Exp $
  17. set testdir [file dirname $argv0]
  18. source $testdir/tester.tcl
  19. do_test misc6-1.1 {
  20. set DB [sqlite3_connection_pointer db]
  21. sqlite3_create_function $DB
  22. set STMT [sqlite3_prepare $DB {SELECT hex8(?)} -1 DUMMY]
  23. set sqlite_static_bind_value {0123456789}
  24. set sqlite_static_bind_nbyte 5
  25. sqlite_bind $STMT 1 {} static-nbytes
  26. sqlite3_step $STMT
  27. } SQLITE_ROW
  28. do_test misc6-1.2 {
  29. sqlite3_column_text $STMT 0
  30. } {3031323334}
  31. ifcapable utf16 {
  32. do_test misc6-1.3 {
  33. sqlite3_finalize $STMT
  34. set STMT [sqlite3_prepare $DB {SELECT hex16(?)} -1 DUMMY]
  35. set sqlite_static_bind_value {0123456789}
  36. set sqlite_static_bind_nbyte 5
  37. sqlite_bind $STMT 1 {} static-nbytes
  38. sqlite3_step $STMT
  39. } SQLITE_ROW
  40. do_test misc6-1.4 {
  41. sqlite3_column_text $STMT 0
  42. } {00300031003200330034}
  43. }
  44. sqlite3_finalize $STMT
  45. finish_test