Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SQLiteConnection connection = ...;
- using (SQLiteCommand command = new SQLiteCommand("SELECT ?, 0x10FFFFFFF, 0x1FFFFFFFF;", connection)) {
- // Add a command parameter with the value 0xFFFFFFFF
- SQLiteParameter parameter = new SQLiteParameter();
- parameter.Value = 0xFFFFFFFF;
- command.Parameters.Add(parameter);
- SQLiteDataReader reader = command.ExecuteReader();
- reader.Read();
- // Test getting 0xFFFFFFFF as Int64
- // EXPECTED: 0xFFFFFFFF
- // ACTUAL: -1
- // Test FAILS
- Assert.AreEqual(0xFFFFFFFF, reader.GetInt64(0));
- // Test getting 0x10FFFFFFF as Int16
- // EXPECTED: OverflowException
- // ACTUAL: OverflowException
- // Test PASSES
- try {
- short value = reader.GetInt16(1);
- Assert.Fail();
- } catch (OverflowException) { }
- // Test getting 0x1FFFFFFFF as Int16
- // EXPECTED: OverflowException
- // ACTUAL: -1
- // Test FAILS
- try {
- short value = reader.GetInt16(2);
- Assert.Fail();
- } catch (OverflowException) { }
- // Test getting 0x10FFFFFFF as Int32
- // EXPECTED: OverflowException
- // ACTUAL: 0xFFFFFFF
- // Test FAILS
- try {
- int value = reader.GetInt32(1);
- Assert.Fail();
- } catch (OverflowException) { }
- // Test getting 0x1FFFFFFFF as Int32
- // EXPECTED: OverflowException
- // ACTUAL: -1
- // Test FAILS
- try {
- int value = reader.GetInt32(2);
- Assert.Fail();
- } catch (OverflowException) { }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement