1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#
require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
describe "FFI::Platform::LIBSUFFIX" do
case TestLibrary::OS
when "linux"
it "returns 'so'" do
expect(FFI::Platform::LIBSUFFIX).to eq('so')
end
when "windows"
it "returns 'dll'" do
expect(FFI::Platform::LIBSUFFIX).to eq('dll')
end
when "darwin"
it "returns 'dylib'" do
expect(FFI::Platform::LIBSUFFIX).to eq('dylib')
end
end
end
describe "FFI::Platform::IS_WINDOWS" do
case TestLibrary::OS
when "linux"
it "returns false" do
expect(FFI::Platform::IS_WINDOWS).to be false
end
when "windows"
it "returns true" do
expect(FFI::Platform::IS_WINDOWS).to be true
end
when "darwin"
it "returns false" do
expect(FFI::Platform::IS_WINDOWS).to be false
end
end
end
describe "FFI::Platform::ARCH" do
it "returns the architecture type" do
expect(FFI::Platform::ARCH).to eq(TestLibrary::CPU)
end
end
describe "FFI::Platform::OS" do
case TestLibrary::OS
when "linux"
it "returns 'linux' as a string" do
expect(FFI::Platform::OS).to eq('linux')
end
when "windows"
it "returns 'windows' as a string" do
expect(FFI::Platform::OS).to eq('windows')
end
when "darwin"
it "returns 'darwin' as a string" do
expect(FFI::Platform::OS).to eq('darwin')
end
end
end
describe "FFI::Platform.windows?" do
case TestLibrary::OS
when "linux"
it "returns false" do
expect(FFI::Platform.windows?).to be false
end
when "windows"
it "returns true" do
expect(FFI::Platform.windows?).to be true
end
when "darwin"
it "returns false" do
expect(FFI::Platform.windows?).to be false
end
end
end
describe "FFI::Platform.mac?" do
case TestLibrary::OS
when "linux"
it "returns false" do
expect(FFI::Platform.mac?).to be false
end
when "windows"
it "returns false" do
expect(FFI::Platform.mac?).to be false
end
when "darwin"
it "returns true" do
expect(FFI::Platform.mac?).to be true
end
end
end
describe "FFI::Platform.unix?" do
case TestLibrary::OS
when "linux"
it "returns true" do
expect(FFI::Platform.unix?).to be true
end
when "windows"
it "returns false" do
expect(FFI::Platform.unix?).to be false
end
when "darwin"
it "returns true" do
expect(FFI::Platform.unix?).to be true
end
end
describe "FFI::Platform::LITTLE_ENDIAN" do
it "returns 1234" do
expect(FFI::Platform::LITTLE_ENDIAN).to eq(1234)
end
end
describe "FFI::Platform::BIG_ENDIAN" do
it "returns 4321" do
expect(FFI::Platform::BIG_ENDIAN).to eq(4321)
end
end
describe "FFI::Platform::BYTE_ORDER" do
it "returns the current byte order" do
if [1234].pack("I") == [1234].pack("N")
order = FFI::Platform::BIG_ENDIAN
else
order = FFI::Platform::LITTLE_ENDIAN
end
expect(FFI::Platform::BYTE_ORDER).to eq(order)
end
end
end
|