Commits

Tuukka Norri committed 06354e6

Wrote some more tests

  • Participants
  • Parent commits 4425a48

Comments (0)

Files changed (2)

File UnitTests/BaseTenTest.sql

 GRANT SELECT, INSERT, UPDATE, DELETE ON float8_test TO baseten_test_user;
 
 
+CREATE TABLE text_test (
+    value TEXT
+);
+INSERT INTO text_test VALUES ('aàáâäå');
+GRANT SELECT, INSERT, UPDATE, DELETE ON text_test TO baseten_test_user;
+
+
+CREATE TABLE int2_test (
+    value int2
+);
+INSERT INTO int2_test VALUES (12);
+GRANT SELECT, INSERT, UPDATE, DELETE ON int2_test TO baseten_test_user;
+
+
+CREATE TABLE int4_test (
+    value int4
+);
+INSERT INTO int4_test VALUES (14);
+GRANT SELECT, INSERT, UPDATE, DELETE ON int4_test TO baseten_test_user;
+
+
+CREATE TABLE int8_test (
+    value int8
+);
+INSERT INTO int8_test VALUES (16);
+GRANT SELECT, INSERT, UPDATE, DELETE ON int8_test TO baseten_test_user;
+
 -- BaseTen tests
 
 CREATE TABLE test (

File UnitTests/Sources/PGTSTypeTests.m

 	[mConnection release];
 }
 
+- (void) testInt2
+{
+	PGTSResultSet* res = [mConnection executeQuery: @"SELECT * FROM int2_test"];
+	STAssertTrue ([res querySucceeded], [[res error] description]);
+	
+	[res advanceRow];
+	NSNumber* value = [res valueForKey: @"value"];
+	MKCAssertNotNil (value);	
+	
+	SInt16 i = 0;
+	MKCAssertTrue (CFNumberGetValue ((CFNumberRef) value, kCFNumberSInt16Type, &i));
+	MKCAssertTrue (12 == i);
+}
+
+- (void) testInt4
+{
+	PGTSResultSet* res = [mConnection executeQuery: @"SELECT * FROM int4_test"];
+	STAssertTrue ([res querySucceeded], [[res error] description]);
+	
+	[res advanceRow];
+	NSNumber* value = [res valueForKey: @"value"];
+	MKCAssertNotNil (value);	
+	
+	SInt32 i = 0;
+	MKCAssertTrue (CFNumberGetValue ((CFNumberRef) value, kCFNumberSInt32Type, &i));
+	MKCAssertTrue (14 == i);
+}
+
+- (void) testInt8
+{
+	PGTSResultSet* res = [mConnection executeQuery: @"SELECT * FROM int8_test"];
+	STAssertTrue ([res querySucceeded], [[res error] description]);
+	
+	[res advanceRow];
+	NSNumber* value = [res valueForKey: @"value"];
+	MKCAssertNotNil (value);	
+	
+	SInt64 i = 0;
+	MKCAssertTrue (CFNumberGetValue ((CFNumberRef) value, kCFNumberSInt64Type, &i));
+	MKCAssertTrue (16 == i);
+}
+
+- (void) testText
+{
+	PGTSResultSet* res = [mConnection executeQuery: @"SELECT * FROM text_test"];
+	STAssertTrue ([res querySucceeded], [[res error] description]);
+	
+	[res advanceRow];
+	NSString* value = [res valueForKey: @"value"];
+	MKCAssertNotNil (value);
+	
+	MKCAssertTrue (NSOrderedSame == [value compare: @"aàáâäå" options: 0]);
+	MKCAssertTrue ([value isEqualToString: [@"aàáâäå" decomposedStringWithCanonicalMapping]]);
+}
+
 - (void) testPoint
 {
 	PGTSResultSet* res = [mConnection executeQuery: @"SELECT * FROM point_test"];