Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tests pass on bigendian architecture #616

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions test/test_pragmas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

module SQLite3
class TestPragmas < SQLite3::TestCase
BIGENDIAN = ([1].pack("I") == [1].pack("N"))

class DatabaseTracker < SQLite3::Database
attr_reader :test_statements

Expand Down Expand Up @@ -78,7 +80,8 @@ def test_encoding_uppercase
assert_equal(Encoding::UTF_8, @db.encoding)

@db.encoding = "UTF-16"
assert_equal(Encoding::UTF_16LE, @db.encoding)
native = BIGENDIAN ? Encoding::UTF_16BE : Encoding::UTF_16LE
assert_equal(native, @db.encoding)

@db.encoding = "UTF-16LE"
assert_equal(Encoding::UTF_16LE, @db.encoding)
Expand All @@ -94,7 +97,8 @@ def test_encoding_lowercase
assert_equal(Encoding::UTF_8, @db.encoding)

@db.encoding = "utf-16"
assert_equal(Encoding::UTF_16LE, @db.encoding)
native = BIGENDIAN ? Encoding::UTF_16BE : Encoding::UTF_16LE
assert_equal(native, @db.encoding)

@db.encoding = "utf-16le"
assert_equal(Encoding::UTF_16LE, @db.encoding)
Expand All @@ -110,7 +114,8 @@ def test_encoding_objects
assert_equal(Encoding::UTF_8, @db.encoding)

@db.encoding = Encoding::UTF_16
assert_equal(Encoding::UTF_16LE, @db.encoding)
native = BIGENDIAN ? Encoding::UTF_16BE : Encoding::UTF_16LE
assert_equal(native, @db.encoding)

@db.encoding = Encoding::UTF_16LE
assert_equal(Encoding::UTF_16LE, @db.encoding)
Expand Down