# Tests internationlization of Oratcl
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# This is test is similar to i18n.test but inserts a different
# unicode string into the database.
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: i18n2.test,v 1.4 1999/10/12 02:01:22 mtariq Exp $

source [file  join [pwd] [file dirname [info script]] defs.tcl]

test oratcl-3.0 {Oracle I18n test 3} { 
    oralogon $oracleuser/$oraclepw@$connstring 
    oraopen oratcl0
    orasql oratcl0.0 "create table internat (name varchar(20), id int)"
    set x  \u0043\u0061\u0066\u00c3\u00a9
    set x_length [string length $x]
    set x_bytes [string bytelength $x]
    set str "insert into internat (name, id) values ('$x', 1)"
    orasql oratcl0.0 $str

    orasql oratcl0.0 "select name from internat where id = 1"
    set result [orafetch oratcl0.0]
    orasql oratcl0.0 "drop table internat"
    oralogoff oratcl0.0
    set result [string trimright $result]
    set result_bytes [string bytelength $result]
    set result_length [string length $result]
    string compare $result $x

 } {0}


proc test_string {res_bytes res_length} {
   if {$res_bytes == $res_length} {
       set return_msg "error: num bytes equal num chars"
       return $return_msg
   }
   if {$res_bytes == 7 && $res_length == 5} {
       set return_msg "test passed"
   }
}
test oratcl-4.0 {Oracle I18n test 4} {
    test_string $result_bytes $result_length
} {test passed}



::tcltest::cleanupTests

return
