mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 21:20:03 +00:00
use Bool for flatbuffers bool instead of Byte (#7876)
Add test for Bool type in swift Co-authored-by: mustiikhalil <26250654+mustiikhalil@users.noreply.github.com>
This commit is contained in:
@@ -217,6 +217,10 @@ class FlatBuffersMonsterWriterTests: XCTestCase {
|
||||
|
||||
XCTAssertEqual(monster.testType, .monster)
|
||||
|
||||
XCTAssertTrue(monster.mutate(testbool: false))
|
||||
XCTAssertEqual(monster.testbool, false)
|
||||
XCTAssertTrue(monster.mutate(testbool: true))
|
||||
|
||||
XCTAssertEqual(monster.mutate(inventory: 1, at: 0), true)
|
||||
XCTAssertEqual(monster.mutate(inventory: 2, at: 1), true)
|
||||
XCTAssertEqual(monster.mutate(inventory: 3, at: 2), true)
|
||||
|
||||
@@ -1221,8 +1221,8 @@ public struct MyGame_Example_Monster: FlatBufferObject, Verifiable, ObjectAPIPac
|
||||
public var testnestedflatbuffer: [UInt8] { return _accessor.getVector(at: VTOFFSET.testnestedflatbuffer.v) ?? [] }
|
||||
public func mutate(testnestedflatbuffer: UInt8, at index: Int32) -> Bool { let o = _accessor.offset(VTOFFSET.testnestedflatbuffer.v); return _accessor.directMutate(testnestedflatbuffer, index: _accessor.vector(at: o) + index * 1) }
|
||||
public var testempty: MyGame_Example_Stat? { let o = _accessor.offset(VTOFFSET.testempty.v); return o == 0 ? nil : MyGame_Example_Stat(_accessor.bb, o: _accessor.indirect(o + _accessor.postion)) }
|
||||
public var testbool: Bool { let o = _accessor.offset(VTOFFSET.testbool.v); return o == 0 ? false : 0 != _accessor.readBuffer(of: Byte.self, at: o) }
|
||||
@discardableResult public func mutate(testbool: Byte) -> Bool {let o = _accessor.offset(VTOFFSET.testbool.v); return _accessor.mutate(testbool, index: o) }
|
||||
public var testbool: Bool { let o = _accessor.offset(VTOFFSET.testbool.v); return o == 0 ? false : _accessor.readBuffer(of: Bool.self, at: o) }
|
||||
@discardableResult public func mutate(testbool: Bool) -> Bool {let o = _accessor.offset(VTOFFSET.testbool.v); return _accessor.mutate(testbool, index: o) }
|
||||
public var testhashs32Fnv1: Int32 { let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: Int32.self, at: o) }
|
||||
@discardableResult public func mutate(testhashs32Fnv1: Int32) -> Bool {let o = _accessor.offset(VTOFFSET.testhashs32Fnv1.v); return _accessor.mutate(testhashs32Fnv1, index: o) }
|
||||
public var testhashu32Fnv1: UInt32 { let o = _accessor.offset(VTOFFSET.testhashu32Fnv1.v); return o == 0 ? 0 : _accessor.readBuffer(of: UInt32.self, at: o) }
|
||||
|
||||
Reference in New Issue
Block a user