Lint tests
This commit is contained in:
parent
29cd66b947
commit
5117127ee3
|
|
@ -1,7 +1,6 @@
|
||||||
included:
|
included:
|
||||||
- Sources
|
- Sources
|
||||||
excluded:
|
excluded:
|
||||||
- Tests
|
|
||||||
- docs
|
- docs
|
||||||
- build
|
- build
|
||||||
identifier_name:
|
identifier_name:
|
||||||
|
|
|
||||||
|
|
@ -10,33 +10,33 @@ import FirebladeECS
|
||||||
class EmptyComponent: Component { }
|
class EmptyComponent: Component { }
|
||||||
|
|
||||||
class Name: Component {
|
class Name: Component {
|
||||||
var name: String
|
var name: String
|
||||||
init(name: String) {
|
init(name: String) {
|
||||||
self.name = name
|
self.name = name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Position: Component {
|
class Position: Component {
|
||||||
var x: Int
|
var x: Int
|
||||||
var y: Int
|
var y: Int
|
||||||
init(x: Int, y: Int) {
|
init(x: Int, y: Int) {
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Velocity: Component {
|
class Velocity: Component {
|
||||||
var a: Float
|
var a: Float
|
||||||
init(a: Float) {
|
init(a: Float) {
|
||||||
self.a = a
|
self.a = a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Party: Component {
|
class Party: Component {
|
||||||
var partying: Bool
|
var partying: Bool
|
||||||
init(partying: Bool) {
|
init(partying: Bool) {
|
||||||
self.partying = partying
|
self.partying = partying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Color: Component {
|
class Color: Component {
|
||||||
|
|
@ -46,26 +46,21 @@ class Color: Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExampleSystem {
|
class ExampleSystem {
|
||||||
private let family: Family2<Position, Velocity>
|
private let family: Family2<Position, Velocity>
|
||||||
|
|
||||||
init(nexus: Nexus) {
|
init(nexus: Nexus) {
|
||||||
family = nexus.family(requiresAll: Position.self, Velocity.self, excludesAll: EmptyComponent.self)
|
family = nexus.family(requiresAll: Position.self, Velocity.self, excludesAll: EmptyComponent.self)
|
||||||
}
|
}
|
||||||
|
|
||||||
func update(deltaT: Double) {
|
func update(deltaT: Double) {
|
||||||
family.forEach { (position: Position, velocity: Velocity) in
|
family.forEach { (position: Position, velocity: Velocity) in
|
||||||
position.x *= 2
|
position.x *= 2
|
||||||
velocity.a *= 2
|
velocity.a *= 2
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final class SingleGameState: SingleComponent {
|
final class SingleGameState: SingleComponent {
|
||||||
var shouldQuit: Bool = false
|
var shouldQuit: Bool = false
|
||||||
var playerHealth: Int = 67
|
var playerHealth: Int = 67
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class ComponentTests: XCTestCase {
|
class ComponentTests: XCTestCase {
|
||||||
|
|
||||||
func testMeasureStaticComponentIdentifier() {
|
func testMeasureStaticComponentIdentifier() {
|
||||||
let number: Int = 10_000
|
let number: Int = 10_000
|
||||||
measure {
|
measure {
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,10 @@
|
||||||
// Created by Christian Treffs on 14.02.19.
|
// Created by Christian Treffs on 14.02.19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import XCTest
|
|
||||||
import FirebladeECS
|
import FirebladeECS
|
||||||
|
import XCTest
|
||||||
|
|
||||||
class HashingPerformanceTests: XCTestCase {
|
class HashingPerformanceTests: XCTestCase {
|
||||||
|
|
||||||
func testMeasureCombineHash() {
|
func testMeasureCombineHash() {
|
||||||
let a: Set<Int> = Set<Int>([14_561_291, 26_451_562, 34_562_182, 488_972_556, 5_128_426_962, 68_211_812])
|
let a: Set<Int> = Set<Int>([14_561_291, 26_451_562, 34_562_182, 488_972_556, 5_128_426_962, 68_211_812])
|
||||||
let b: Set<Int> = Set<Int>([1_083_838, 912_312, 83_333, 71_234_555, 4_343_234])
|
let b: Set<Int> = Set<Int>([1_083_838, 912_312, 83_333, 71_234_555, 4_343_234])
|
||||||
|
|
@ -37,6 +36,4 @@ class HashingPerformanceTests: XCTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class TypedFamilyPerformanceTests: XCTestCase {
|
class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
|
|
||||||
let numEntities: Int = 10_000
|
let numEntities: Int = 10_000
|
||||||
var nexus: Nexus!
|
var nexus: Nexus!
|
||||||
|
|
||||||
|
|
@ -19,10 +18,10 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
|
|
||||||
for i in 0..<numEntities {
|
for i in 0..<numEntities {
|
||||||
nexus.createEntity().assign(Position(x: 1 + i, y: 2 + i),
|
nexus.createEntity().assign(Position(x: 1 + i, y: 2 + i),
|
||||||
Name(name: "myName\(i)"),
|
Name(name: "myName\(i)"),
|
||||||
Velocity(a: 3.14),
|
Velocity(a: 3.14),
|
||||||
EmptyComponent(),
|
EmptyComponent(),
|
||||||
Color())
|
Color())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,7 +31,6 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testMeasureTraitMatching() {
|
func testMeasureTraitMatching() {
|
||||||
|
|
||||||
let a = nexus.createEntity()
|
let a = nexus.createEntity()
|
||||||
a.assign(Position(x: 1, y: 2))
|
a.assign(Position(x: 1, y: 2))
|
||||||
a.assign(Name(name: "myName"))
|
a.assign(Name(name: "myName"))
|
||||||
|
|
@ -67,7 +65,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = entity
|
_ = entity
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -83,7 +81,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
.forEach { (position: Position) in
|
.forEach { (position: Position) in
|
||||||
_ = position
|
_ = position
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, numEntities * 10)
|
XCTAssertEqual(loopCount, numEntities * 10)
|
||||||
|
|
@ -105,7 +103,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = position
|
_ = position
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -129,7 +127,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = position
|
_ = position
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -152,7 +150,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = velocity
|
_ = velocity
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -177,7 +175,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = velocity
|
_ = velocity
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -201,7 +199,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = name
|
_ = name
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -227,7 +225,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = name
|
_ = name
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -252,7 +250,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = color
|
_ = color
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -279,7 +277,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = color
|
_ = color
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
@ -332,7 +330,7 @@ class TypedFamilyPerformanceTests: XCTestCase {
|
||||||
_ = empty
|
_ = empty
|
||||||
|
|
||||||
loopCount += 1
|
loopCount += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(loopCount, family.count * 10)
|
XCTAssertEqual(loopCount, family.count * 10)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ extension ComponentTests {
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__ComponentTests = [
|
static let __allTests__ComponentTests = [
|
||||||
("testMeasureComponentIdentifier", testMeasureComponentIdentifier),
|
("testMeasureComponentIdentifier", testMeasureComponentIdentifier),
|
||||||
("testMeasureStaticComponentIdentifier", testMeasureStaticComponentIdentifier),
|
("testMeasureStaticComponentIdentifier", testMeasureStaticComponentIdentifier)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ extension HashingPerformanceTests {
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__HashingPerformanceTests = [
|
static let __allTests__HashingPerformanceTests = [
|
||||||
("testMeasureCombineHash", testMeasureCombineHash),
|
("testMeasureCombineHash", testMeasureCombineHash),
|
||||||
("testMeasureSetOfSetHash", testMeasureSetOfSetHash),
|
("testMeasureSetOfSetHash", testMeasureSetOfSetHash)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ extension TypedFamilyPerformanceTests {
|
||||||
("testPerformanceTypedFamilyFourComponents", testPerformanceTypedFamilyFourComponents),
|
("testPerformanceTypedFamilyFourComponents", testPerformanceTypedFamilyFourComponents),
|
||||||
("testPerformanceTypedFamilyOneComponent", testPerformanceTypedFamilyOneComponent),
|
("testPerformanceTypedFamilyOneComponent", testPerformanceTypedFamilyOneComponent),
|
||||||
("testPerformanceTypedFamilyThreeComponents", testPerformanceTypedFamilyThreeComponents),
|
("testPerformanceTypedFamilyThreeComponents", testPerformanceTypedFamilyThreeComponents),
|
||||||
("testPerformanceTypedFamilyTwoComponents", testPerformanceTypedFamilyTwoComponents),
|
("testPerformanceTypedFamilyTwoComponents", testPerformanceTypedFamilyTwoComponents)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public func __allTests() -> [XCTestCaseEntry] {
|
||||||
return [
|
return [
|
||||||
testCase(ComponentTests.__allTests__ComponentTests),
|
testCase(ComponentTests.__allTests__ComponentTests),
|
||||||
testCase(HashingPerformanceTests.__allTests__HashingPerformanceTests),
|
testCase(HashingPerformanceTests.__allTests__HashingPerformanceTests),
|
||||||
testCase(TypedFamilyPerformanceTests.__allTests__TypedFamilyPerformanceTests),
|
testCase(TypedFamilyPerformanceTests.__allTests__TypedFamilyPerformanceTests)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,11 @@
|
||||||
// Created by Christian Treffs on 25.06.19.
|
// Created by Christian Treffs on 25.06.19.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import FirebladeECS
|
import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
#if swift(>=5.1)
|
#if swift(>=5.1)
|
||||||
class AccessTests: XCTestCase {
|
class AccessTests: XCTestCase {
|
||||||
|
|
||||||
func testReadOnly() {
|
func testReadOnly() {
|
||||||
let pos = Position(x: 1, y: 2)
|
let pos = Position(x: 1, y: 2)
|
||||||
|
|
||||||
|
|
@ -39,7 +36,6 @@ class AccessTests: XCTestCase {
|
||||||
|
|
||||||
XCTAssertEqual(writable.y, 2)
|
XCTAssertEqual(writable.y, 2)
|
||||||
XCTAssertEqual(pos.y, 2)
|
XCTAssertEqual(pos.y, 2)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -45,14 +45,11 @@ class Color: Component {
|
||||||
var b: UInt8 = 0
|
var b: UInt8 = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final class SingleGameState: SingleComponent {
|
final class SingleGameState: SingleComponent {
|
||||||
var shouldQuit: Bool = false
|
var shouldQuit: Bool = false
|
||||||
var playerHealth: Int = 67
|
var playerHealth: Int = 67
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ExampleSystem {
|
class ExampleSystem {
|
||||||
private let family: Family2<Position, Velocity>
|
private let family: Family2<Position, Velocity>
|
||||||
|
|
||||||
|
|
@ -64,16 +61,11 @@ class ExampleSystem {
|
||||||
family.forEach { (position: Position, velocity: Velocity) in
|
family.forEach { (position: Position, velocity: Velocity) in
|
||||||
position.x *= 2
|
position.x *= 2
|
||||||
velocity.a *= 2
|
velocity.a *= 2
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ColorSystem {
|
class ColorSystem {
|
||||||
|
|
||||||
let nexus: Nexus
|
let nexus: Nexus
|
||||||
lazy var colors = nexus.family(requires: Color.self)
|
lazy var colors = nexus.family(requires: Color.self)
|
||||||
|
|
||||||
|
|
@ -87,7 +79,7 @@ class ColorSystem {
|
||||||
color.r = 1
|
color.r = 1
|
||||||
color.g = 2
|
color.g = 2
|
||||||
color.b = 3
|
color.b = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,7 +99,6 @@ class PositionSystem {
|
||||||
func update() {
|
func update() {
|
||||||
positions
|
positions
|
||||||
.forEach { [unowned self](pos: Position) in
|
.forEach { [unowned self](pos: Position) in
|
||||||
|
|
||||||
let deltaX: Double = self.velocity * ((self.randNorm() * 2) - 1)
|
let deltaX: Double = self.velocity * ((self.randNorm() * 2) - 1)
|
||||||
let deltaY: Double = self.velocity * ((self.randNorm() * 2) - 1)
|
let deltaY: Double = self.velocity * ((self.randNorm() * 2) - 1)
|
||||||
let x = pos.x + Int(deltaX)
|
let x = pos.x + Int(deltaX)
|
||||||
|
|
@ -115,8 +106,6 @@ class PositionSystem {
|
||||||
|
|
||||||
pos.x = x
|
pos.x = x
|
||||||
pos.y = y
|
pos.y = y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,9 @@ import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class ComponentTests: XCTestCase {
|
class ComponentTests: XCTestCase {
|
||||||
|
func testComponentIdentifier() {
|
||||||
func testComponentIdentifier() {
|
XCTAssertEqual(Position.identifier, Position.identifier)
|
||||||
XCTAssertEqual(Position.identifier, Position.identifier)
|
XCTAssertEqual(Velocity.identifier, Velocity.identifier)
|
||||||
XCTAssertEqual(Velocity.identifier, Velocity.identifier)
|
|
||||||
XCTAssertNotEqual(Velocity.identifier, Position.identifier)
|
XCTAssertNotEqual(Velocity.identifier, Position.identifier)
|
||||||
|
|
||||||
let p1 = Position(x: 1, y: 2)
|
let p1 = Position(x: 1, y: 2)
|
||||||
|
|
@ -20,8 +19,5 @@ class ComponentTests: XCTestCase {
|
||||||
XCTAssertEqual(p1.identifier, Position.identifier)
|
XCTAssertEqual(p1.identifier, Position.identifier)
|
||||||
XCTAssertEqual(v1.identifier, Velocity.identifier)
|
XCTAssertEqual(v1.identifier, Velocity.identifier)
|
||||||
XCTAssertNotEqual(v1.identifier, p1.identifier)
|
XCTAssertNotEqual(v1.identifier, p1.identifier)
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,20 +9,16 @@ import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class EntityTests: XCTestCase {
|
class EntityTests: XCTestCase {
|
||||||
|
func testEntityIdentifierAndIndex() {
|
||||||
func testEntityIdentifierAndIndex() {
|
let min = EntityIdentifier(.min)
|
||||||
|
XCTAssertEqual(min.index, Int(UInt32.min))
|
||||||
let min = EntityIdentifier(.min)
|
|
||||||
XCTAssertEqual(min.index, Int(UInt32.min))
|
|
||||||
|
|
||||||
let uRand = UInt32.random(in: UInt32.min...UInt32.max)
|
let uRand = UInt32.random(in: UInt32.min...UInt32.max)
|
||||||
let rand = EntityIdentifier(uRand)
|
let rand = EntityIdentifier(uRand)
|
||||||
XCTAssertEqual(rand.index, Int(uRand))
|
XCTAssertEqual(rand.index, Int(uRand))
|
||||||
|
|
||||||
let max = EntityIdentifier(.max)
|
let max = EntityIdentifier(.max)
|
||||||
XCTAssertEqual(max, EntityIdentifier.invalid)
|
XCTAssertEqual(max, EntityIdentifier.invalid)
|
||||||
XCTAssertEqual(max.index, Int(UInt32.max))
|
XCTAssertEqual(max.index, Int(UInt32.max))
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class FamilyTests: XCTestCase {
|
class FamilyTests: XCTestCase {
|
||||||
|
|
||||||
var nexus: Nexus!
|
var nexus: Nexus!
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
|
|
@ -29,7 +28,6 @@ class FamilyTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFamilyCreation() {
|
func testFamilyCreation() {
|
||||||
|
|
||||||
let family = nexus.family(requires: Position.self,
|
let family = nexus.family(requires: Position.self,
|
||||||
excludesAll: Name.self)
|
excludesAll: Name.self)
|
||||||
|
|
||||||
|
|
@ -44,7 +42,6 @@ class FamilyTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFamilyReuse() {
|
func testFamilyReuse() {
|
||||||
|
|
||||||
let familyA = nexus.family(requires: Position.self,
|
let familyA = nexus.family(requires: Position.self,
|
||||||
excludesAll: Name.self)
|
excludesAll: Name.self)
|
||||||
|
|
||||||
|
|
@ -83,7 +80,6 @@ class FamilyTests: XCTestCase {
|
||||||
XCTAssertEqual(nexus.numFamilies, 1)
|
XCTAssertEqual(nexus.numFamilies, 1)
|
||||||
XCTAssertEqual(nexus.numComponents, 0)
|
XCTAssertEqual(nexus.numComponents, 0)
|
||||||
XCTAssertEqual(nexus.numEntities, 0)
|
XCTAssertEqual(nexus.numEntities, 0)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFamilyLateMember() {
|
func testFamilyLateMember() {
|
||||||
|
|
@ -121,7 +117,7 @@ class FamilyTests: XCTestCase {
|
||||||
|
|
||||||
familyA
|
familyA
|
||||||
.entityAndComponents
|
.entityAndComponents
|
||||||
.forEach { (entity: Entity, position: Position) in
|
.forEach { (entity: Entity, _: Position) in
|
||||||
entity.assign(Velocity(a: 3.14))
|
entity.assign(Velocity(a: 3.14))
|
||||||
entity.remove(Position.self)
|
entity.remove(Position.self)
|
||||||
}
|
}
|
||||||
|
|
@ -132,17 +128,15 @@ class FamilyTests: XCTestCase {
|
||||||
familyB
|
familyB
|
||||||
.entityAndComponents
|
.entityAndComponents
|
||||||
.forEach { (entity: Entity, velocity: Velocity) in
|
.forEach { (entity: Entity, velocity: Velocity) in
|
||||||
entity.assign(Position(x: 1, y: 2))
|
entity.assign(Position(x: 1, y: 2))
|
||||||
entity.remove(velocity)
|
entity.remove(velocity)
|
||||||
}
|
}
|
||||||
|
|
||||||
XCTAssertEqual(familyA.count, 10)
|
XCTAssertEqual(familyA.count, 10)
|
||||||
XCTAssertEqual(familyB.count, 0)
|
XCTAssertEqual(familyB.count, 0)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testFamilyMemberBasicIteration() {
|
func testFamilyMemberBasicIteration() {
|
||||||
|
|
||||||
for i in 0..<1000 {
|
for i in 0..<1000 {
|
||||||
nexus.createEntity(with: Position(x: i + 1, y: i + 2))
|
nexus.createEntity(with: Position(x: i + 1, y: i + 2))
|
||||||
nexus.createEntity(with: Velocity(a: Float(i)))
|
nexus.createEntity(with: Velocity(a: Float(i)))
|
||||||
|
|
@ -181,8 +175,7 @@ class FamilyTests: XCTestCase {
|
||||||
.prefix(currentCount)
|
.prefix(currentCount)
|
||||||
.forEach { (entity: Entity) in
|
.forEach { (entity: Entity) in
|
||||||
entity.destroy()
|
entity.destroy()
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
XCTAssertEqual(family.memberIds.count, (count / 2))
|
XCTAssertEqual(family.memberIds.count, (count / 2))
|
||||||
|
|
||||||
|
|
@ -192,5 +185,4 @@ class FamilyTests: XCTestCase {
|
||||||
|
|
||||||
XCTAssertEqual(family.memberIds.count, count + (count / 2))
|
XCTAssertEqual(family.memberIds.count, count + (count / 2))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class FamilyTraitsTests: XCTestCase {
|
class FamilyTraitsTests: XCTestCase {
|
||||||
|
|
||||||
var nexus: Nexus!
|
var nexus: Nexus!
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
|
|
@ -23,7 +22,6 @@ class FamilyTraitsTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTraitCommutativity() {
|
func testTraitCommutativity() {
|
||||||
|
|
||||||
let t1 = FamilyTraitSet(requiresAll: [Position.self, Velocity.self],
|
let t1 = FamilyTraitSet(requiresAll: [Position.self, Velocity.self],
|
||||||
excludesAll: [Name.self])
|
excludesAll: [Name.self])
|
||||||
let t2 = FamilyTraitSet(requiresAll: [Velocity.self, Position.self],
|
let t2 = FamilyTraitSet(requiresAll: [Velocity.self, Position.self],
|
||||||
|
|
@ -31,11 +29,9 @@ class FamilyTraitsTests: XCTestCase {
|
||||||
|
|
||||||
XCTAssertEqual(t1, t2)
|
XCTAssertEqual(t1, t2)
|
||||||
XCTAssertEqual(t1.hashValue, t2.hashValue)
|
XCTAssertEqual(t1.hashValue, t2.hashValue)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testTraitMatching() {
|
func testTraitMatching() {
|
||||||
|
|
||||||
let a = nexus.createEntity()
|
let a = nexus.createEntity()
|
||||||
a.assign(Position(x: 1, y: 2))
|
a.assign(Position(x: 1, y: 2))
|
||||||
a.assign(Name(name: "myName"))
|
a.assign(Name(name: "myName"))
|
||||||
|
|
@ -49,7 +45,5 @@ class FamilyTraitsTests: XCTestCase {
|
||||||
|
|
||||||
XCTAssertFalse(noMatch.canBecomeMember(a))
|
XCTAssertFalse(noMatch.canBecomeMember(a))
|
||||||
XCTAssertTrue(isMatch.canBecomeMember(a))
|
XCTAssertTrue(isMatch.canBecomeMember(a))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class HashingTests: XCTestCase {
|
class HashingTests: XCTestCase {
|
||||||
|
|
||||||
func makeComponent() -> Int {
|
func makeComponent() -> Int {
|
||||||
let upperBound: Int = 44
|
let upperBound: Int = 44
|
||||||
let range = UInt32.min...UInt32.max
|
let range = UInt32.min...UInt32.max
|
||||||
|
|
@ -25,7 +24,6 @@ class HashingTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCollisionsInCritialRange() {
|
func testCollisionsInCritialRange() {
|
||||||
|
|
||||||
var hashSet: Set<Int> = Set<Int>()
|
var hashSet: Set<Int> = Set<Int>()
|
||||||
|
|
||||||
var range: CountableRange<UInt32> = 0 ..< 1_000_000
|
var range: CountableRange<UInt32> = 0 ..< 1_000_000
|
||||||
|
|
@ -52,6 +50,4 @@ class HashingTests: XCTestCase {
|
||||||
XCTAssert(EntityComponentHash.decompose(h, with: entityId) == cH)
|
XCTAssert(EntityComponentHash.decompose(h, with: entityId) == cH)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,24 @@ import FirebladeECS
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class NexusTests: XCTestCase {
|
class NexusTests: XCTestCase {
|
||||||
|
|
||||||
var nexus: Nexus!
|
var nexus: Nexus!
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
super.setUp()
|
super.setUp()
|
||||||
nexus = Nexus()
|
nexus = Nexus()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tearDown() {
|
override func tearDown() {
|
||||||
nexus = nil
|
nexus = nil
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEntityCreate() {
|
func testEntityCreate() {
|
||||||
XCTAssertEqual(nexus.numEntities, 0)
|
XCTAssertEqual(nexus.numEntities, 0)
|
||||||
|
|
||||||
let e0 = nexus.createEntity()
|
let e0 = nexus.createEntity()
|
||||||
|
|
||||||
XCTAssertEqual(e0.identifier.index, 0)
|
XCTAssertEqual(e0.identifier.index, 0)
|
||||||
XCTAssertEqual(nexus.numEntities, 1)
|
XCTAssertEqual(nexus.numEntities, 1)
|
||||||
|
|
||||||
let e1 = nexus.createEntity(with: Name(name: "Entity 1"))
|
let e1 = nexus.createEntity(with: Name(name: "Entity 1"))
|
||||||
|
|
@ -37,7 +36,7 @@ class NexusTests: XCTestCase {
|
||||||
|
|
||||||
//FIXME: XCTAssertNil(e0.name)
|
//FIXME: XCTAssertNil(e0.name)
|
||||||
//FIXME: XCTAssertEqual(e1.name, "Entity 1")
|
//FIXME: XCTAssertEqual(e1.name, "Entity 1")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEntityDestroy() {
|
func testEntityDestroy() {
|
||||||
testEntityCreate()
|
testEntityCreate()
|
||||||
|
|
@ -61,72 +60,69 @@ class NexusTests: XCTestCase {
|
||||||
XCTAssertEqual(nexus.numEntities, 0)
|
XCTAssertEqual(nexus.numEntities, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testComponentCreation() {
|
func testComponentCreation() {
|
||||||
|
XCTAssert(nexus.numEntities == 0)
|
||||||
|
|
||||||
XCTAssert(nexus.numEntities == 0)
|
let e0: Entity = nexus.createEntity()
|
||||||
|
|
||||||
let e0: Entity = nexus.createEntity()
|
let p0 = Position(x: 1, y: 2)
|
||||||
|
|
||||||
let p0 = Position(x: 1, y: 2)
|
e0.assign(p0)
|
||||||
|
|
||||||
e0.assign(p0)
|
|
||||||
// component collision: e0.assign(p0)
|
// component collision: e0.assign(p0)
|
||||||
|
|
||||||
XCTAssert(e0.hasComponents)
|
XCTAssert(e0.hasComponents)
|
||||||
XCTAssert(e0.numComponents == 1)
|
XCTAssert(e0.numComponents == 1)
|
||||||
|
|
||||||
let rP0: Position = e0.get(component: Position.self)!
|
let rP0: Position = e0.get(component: Position.self)!
|
||||||
XCTAssert(rP0.x == 1)
|
XCTAssert(rP0.x == 1)
|
||||||
XCTAssert(rP0.y == 2)
|
XCTAssert(rP0.y == 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testComponentDeletion() {
|
func testComponentDeletion() {
|
||||||
|
let identifier: EntityIdentifier = nexus.createEntity().identifier
|
||||||
|
|
||||||
let identifier: EntityIdentifier = nexus.createEntity().identifier
|
let e0 = nexus.get(entity: identifier)!
|
||||||
|
|
||||||
let e0 = nexus.get(entity: identifier)!
|
XCTAssert(e0.numComponents == 0)
|
||||||
|
e0.remove(Position.self)
|
||||||
|
XCTAssert(e0.numComponents == 0)
|
||||||
|
|
||||||
XCTAssert(e0.numComponents == 0)
|
let n0 = Name(name: "myName")
|
||||||
e0.remove(Position.self)
|
let p0 = Position(x: 99, y: 111)
|
||||||
XCTAssert(e0.numComponents == 0)
|
|
||||||
|
|
||||||
let n0 = Name(name: "myName")
|
e0.assign(n0)
|
||||||
let p0 = Position(x: 99, y: 111)
|
XCTAssert(e0.numComponents == 1)
|
||||||
|
XCTAssert(e0.hasComponents)
|
||||||
|
|
||||||
e0.assign(n0)
|
e0.remove(Name.self)
|
||||||
XCTAssert(e0.numComponents == 1)
|
|
||||||
XCTAssert(e0.hasComponents)
|
|
||||||
|
|
||||||
e0.remove(Name.self)
|
XCTAssert(e0.numComponents == 0)
|
||||||
|
XCTAssert(!e0.hasComponents)
|
||||||
|
|
||||||
XCTAssert(e0.numComponents == 0)
|
e0.assign(p0)
|
||||||
XCTAssert(!e0.hasComponents)
|
|
||||||
|
|
||||||
e0.assign(p0)
|
XCTAssert(e0.numComponents == 1)
|
||||||
|
XCTAssert(e0.hasComponents)
|
||||||
|
|
||||||
XCTAssert(e0.numComponents == 1)
|
e0.remove(p0)
|
||||||
XCTAssert(e0.hasComponents)
|
|
||||||
|
|
||||||
e0.remove(p0)
|
XCTAssert(e0.numComponents == 0)
|
||||||
|
XCTAssert(!e0.hasComponents)
|
||||||
|
|
||||||
XCTAssert(e0.numComponents == 0)
|
e0.assign(n0)
|
||||||
XCTAssert(!e0.hasComponents)
|
e0.assign(p0)
|
||||||
|
|
||||||
e0.assign(n0)
|
XCTAssert(e0.numComponents == 2)
|
||||||
e0.assign(p0)
|
let (name, position) = e0.get(components: Name.self, Position.self)
|
||||||
|
|
||||||
XCTAssert(e0.numComponents == 2)
|
XCTAssert(name?.name == "myName")
|
||||||
let (name, position) = e0.get(components: Name.self, Position.self)
|
XCTAssert(position?.x == 99)
|
||||||
|
XCTAssert(position?.y == 111)
|
||||||
|
|
||||||
XCTAssert(name?.name == "myName")
|
e0.destroy()
|
||||||
XCTAssert(position?.x == 99)
|
|
||||||
XCTAssert(position?.y == 111)
|
|
||||||
|
|
||||||
e0.destroy()
|
XCTAssert(e0.numComponents == 0)
|
||||||
|
}
|
||||||
XCTAssert(e0.numComponents == 0)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func testComponentRetrieval() {
|
func testComponentRetrieval() {
|
||||||
let pos = Position(x: 1, y: 2)
|
let pos = Position(x: 1, y: 2)
|
||||||
|
|
@ -136,33 +132,29 @@ class NexusTests: XCTestCase {
|
||||||
|
|
||||||
let (rPos, rName, rVel) = entity.get(components: Position.self, Name.self, Velocity.self)
|
let (rPos, rName, rVel) = entity.get(components: Position.self, Name.self, Velocity.self)
|
||||||
|
|
||||||
|
|
||||||
XCTAssertTrue(rPos === pos)
|
XCTAssertTrue(rPos === pos)
|
||||||
XCTAssertTrue(rName === name)
|
XCTAssertTrue(rName === name)
|
||||||
XCTAssertTrue(rVel === vel)
|
XCTAssertTrue(rVel === vel)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testComponentUniqueness() {
|
func testComponentUniqueness() {
|
||||||
let a = nexus.createEntity()
|
let a = nexus.createEntity()
|
||||||
let b = nexus.createEntity()
|
let b = nexus.createEntity()
|
||||||
let c = nexus.createEntity()
|
let c = nexus.createEntity()
|
||||||
|
|
||||||
XCTAssert(nexus.numEntities == 3)
|
XCTAssert(nexus.numEntities == 3)
|
||||||
|
|
||||||
a.assign(Position(x: 0, y: 0))
|
a.assign(Position(x: 0, y: 0))
|
||||||
b.assign(Position(x: 0, y: 0))
|
b.assign(Position(x: 0, y: 0))
|
||||||
c.assign(Position(x: 0, y: 0))
|
c.assign(Position(x: 0, y: 0))
|
||||||
|
|
||||||
let pA: Position = a.get()!
|
let pA: Position = a.get()!
|
||||||
let pB: Position = b.get()!
|
let pB: Position = b.get()!
|
||||||
|
|
||||||
pA.x = 23
|
pA.x = 23
|
||||||
pA.y = 32
|
pA.y = 32
|
||||||
|
|
||||||
XCTAssert(pB.x != pA.x)
|
|
||||||
XCTAssert(pB.y != pA.y)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
XCTAssert(pB.x != pA.x)
|
||||||
|
XCTAssert(pB.y != pA.y)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ class SingleTests: XCTestCase {
|
||||||
XCTAssertEqual(singleA, singleB)
|
XCTAssertEqual(singleA, singleB)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func testSingleEntityAndComponentCreation() {
|
func testSingleEntityAndComponentCreation() {
|
||||||
let single = nexus.single(SingleGameState.self)
|
let single = nexus.single(SingleGameState.self)
|
||||||
let gameState = SingleGameState()
|
let gameState = SingleGameState()
|
||||||
|
|
@ -54,7 +53,6 @@ class SingleTests: XCTestCase {
|
||||||
XCTAssertNotNil(single.component)
|
XCTAssertNotNil(single.component)
|
||||||
XCTAssertEqual(single.component.shouldQuit, gameState.shouldQuit)
|
XCTAssertEqual(single.component.shouldQuit, gameState.shouldQuit)
|
||||||
XCTAssertEqual(single.component.playerHealth, gameState.playerHealth)
|
XCTAssertEqual(single.component.playerHealth, gameState.playerHealth)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSingleCreationOnExistingFamilyMember() {
|
func testSingleCreationOnExistingFamilyMember() {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class SparseSetTests: XCTestCase {
|
class SparseSetTests: XCTestCase {
|
||||||
|
|
||||||
var set: UnorderedSparseSet<Position>!
|
var set: UnorderedSparseSet<Position>!
|
||||||
|
|
||||||
override func setUp() {
|
override func setUp() {
|
||||||
|
|
@ -23,7 +22,6 @@ class SparseSetTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetAdd() {
|
func testSparseSetAdd() {
|
||||||
|
|
||||||
let num: Int = 100
|
let num: Int = 100
|
||||||
|
|
||||||
for idx in 0..<num {
|
for idx in 0..<num {
|
||||||
|
|
@ -47,7 +45,6 @@ class SparseSetTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetAddAndReplace() {
|
func testSparseSetAddAndReplace() {
|
||||||
|
|
||||||
let p1 = Position(x: 1, y: 1)
|
let p1 = Position(x: 1, y: 1)
|
||||||
let p2 = Position(x: 2, y: 2)
|
let p2 = Position(x: 2, y: 2)
|
||||||
|
|
||||||
|
|
@ -60,11 +57,9 @@ class SparseSetTests: XCTestCase {
|
||||||
|
|
||||||
XCTAssertEqual(set.get(at: 10)?.x, p2.x)
|
XCTAssertEqual(set.get(at: 10)?.x, p2.x)
|
||||||
XCTAssertEqual(set.count, 1)
|
XCTAssertEqual(set.count, 1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetGet() {
|
func testSparseSetGet() {
|
||||||
|
|
||||||
let p1 = Position(x: 1, y: 1)
|
let p1 = Position(x: 1, y: 1)
|
||||||
|
|
||||||
set.insert(p1, at: 10)
|
set.insert(p1, at: 10)
|
||||||
|
|
@ -79,7 +74,6 @@ class SparseSetTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetRemove() {
|
func testSparseSetRemove() {
|
||||||
|
|
||||||
let num: Int = 7
|
let num: Int = 7
|
||||||
|
|
||||||
for idx in 0..<num {
|
for idx in 0..<num {
|
||||||
|
|
@ -358,7 +352,6 @@ class SparseSetTests: XCTestCase {
|
||||||
XCTAssertEqual(set.sparse[5], nil)
|
XCTAssertEqual(set.sparse[5], nil)
|
||||||
XCTAssertEqual(set.sparse[6], nil)
|
XCTAssertEqual(set.sparse[6], nil)
|
||||||
XCTAssertEqual(set.sparse[7], nil)
|
XCTAssertEqual(set.sparse[7], nil)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetRemoveAndAdd() {
|
func testSparseSetRemoveAndAdd() {
|
||||||
|
|
@ -384,11 +377,9 @@ class SparseSetTests: XCTestCase {
|
||||||
XCTAssertEqual(set.get(at: 56)?.x, 56)
|
XCTAssertEqual(set.get(at: 56)?.x, 56)
|
||||||
XCTAssertEqual(set.get(at: 99)?.x, 99)
|
XCTAssertEqual(set.get(at: 99)?.x, 99)
|
||||||
XCTAssertEqual(set.get(at: 3)?.x, 3)
|
XCTAssertEqual(set.get(at: 3)?.x, 3)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetRemoveNonPresent() {
|
func testSparseSetRemoveNonPresent() {
|
||||||
|
|
||||||
XCTAssertTrue(set.isEmpty)
|
XCTAssertTrue(set.isEmpty)
|
||||||
XCTAssertNil(set.remove(at: 100))
|
XCTAssertNil(set.remove(at: 100))
|
||||||
XCTAssertTrue(set.isEmpty)
|
XCTAssertTrue(set.isEmpty)
|
||||||
|
|
@ -427,11 +418,9 @@ class SparseSetTests: XCTestCase {
|
||||||
XCTAssertTrue(set.get(at: 0) === a)
|
XCTAssertTrue(set.get(at: 0) === a)
|
||||||
|
|
||||||
XCTAssertEqual(set.count, 1)
|
XCTAssertEqual(set.count, 1)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetNonCongiuousData() {
|
func testSparseSetNonCongiuousData() {
|
||||||
|
|
||||||
var indices: Set<Int> = [0, 30, 1, 21, 78, 56, 99, 3]
|
var indices: Set<Int> = [0, 30, 1, 21, 78, 56, 99, 3]
|
||||||
|
|
||||||
for idx in indices {
|
for idx in indices {
|
||||||
|
|
@ -462,7 +451,6 @@ class SparseSetTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSparseSetClear() {
|
func testSparseSetClear() {
|
||||||
|
|
||||||
let num: Int = 100
|
let num: Int = 100
|
||||||
|
|
||||||
XCTAssertEqual(set.count, 0)
|
XCTAssertEqual(set.count, 0)
|
||||||
|
|
@ -506,7 +494,6 @@ class SparseSetTests: XCTestCase {
|
||||||
|
|
||||||
// NOTE: this tests only dense insertion order, this is no guarantee for the real ordering.
|
// NOTE: this tests only dense insertion order, this is no guarantee for the real ordering.
|
||||||
XCTAssertEqual(string, "Hello World")
|
XCTAssertEqual(string, "Hello World")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSubscript() {
|
func testSubscript() {
|
||||||
|
|
@ -541,7 +528,6 @@ class SparseSetTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testStartEndIndex() {
|
func testStartEndIndex() {
|
||||||
|
|
||||||
let set = UnorderedSparseSet<Character>()
|
let set = UnorderedSparseSet<Character>()
|
||||||
|
|
||||||
set.insert("C", at: 33)
|
set.insert("C", at: 33)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
class SystemsTests: XCTestCase {
|
class SystemsTests: XCTestCase {
|
||||||
|
|
||||||
var nexus: Nexus!
|
var nexus: Nexus!
|
||||||
var colorSystem: ColorSystem!
|
var colorSystem: ColorSystem!
|
||||||
var positionSystem: PositionSystem!
|
var positionSystem: PositionSystem!
|
||||||
|
|
@ -26,11 +25,9 @@ class SystemsTests: XCTestCase {
|
||||||
positionSystem = nil
|
positionSystem = nil
|
||||||
nexus = nil
|
nexus = nil
|
||||||
super.tearDown()
|
super.tearDown()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSystemsUpdate() {
|
func testSystemsUpdate() {
|
||||||
|
|
||||||
let num: Int = 10_000
|
let num: Int = 10_000
|
||||||
|
|
||||||
colorSystem.update()
|
colorSystem.update()
|
||||||
|
|
@ -124,7 +121,6 @@ class SystemsTests: XCTestCase {
|
||||||
.prefix(count)
|
.prefix(count)
|
||||||
.forEach { (entity: Entity) in
|
.forEach { (entity: Entity) in
|
||||||
entity.destroy()
|
entity.destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ extension ComponentTests {
|
||||||
// `swift test --generate-linuxmain`
|
// `swift test --generate-linuxmain`
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__ComponentTests = [
|
static let __allTests__ComponentTests = [
|
||||||
("testComponentIdentifier", testComponentIdentifier),
|
("testComponentIdentifier", testComponentIdentifier)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ extension EntityTests {
|
||||||
// `swift test --generate-linuxmain`
|
// `swift test --generate-linuxmain`
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__EntityTests = [
|
static let __allTests__EntityTests = [
|
||||||
("testEntityIdentifierAndIndex", testEntityIdentifierAndIndex),
|
("testEntityIdentifierAndIndex", testEntityIdentifierAndIndex)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ extension FamilyTests {
|
||||||
("testFamilyExchange", testFamilyExchange),
|
("testFamilyExchange", testFamilyExchange),
|
||||||
("testFamilyLateMember", testFamilyLateMember),
|
("testFamilyLateMember", testFamilyLateMember),
|
||||||
("testFamilyMemberBasicIteration", testFamilyMemberBasicIteration),
|
("testFamilyMemberBasicIteration", testFamilyMemberBasicIteration),
|
||||||
("testFamilyReuse", testFamilyReuse),
|
("testFamilyReuse", testFamilyReuse)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ extension FamilyTraitsTests {
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__FamilyTraitsTests = [
|
static let __allTests__FamilyTraitsTests = [
|
||||||
("testTraitCommutativity", testTraitCommutativity),
|
("testTraitCommutativity", testTraitCommutativity),
|
||||||
("testTraitMatching", testTraitMatching),
|
("testTraitMatching", testTraitMatching)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ extension HashingTests {
|
||||||
// `swift test --generate-linuxmain`
|
// `swift test --generate-linuxmain`
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__HashingTests = [
|
static let __allTests__HashingTests = [
|
||||||
("testCollisionsInCritialRange", testCollisionsInCritialRange),
|
("testCollisionsInCritialRange", testCollisionsInCritialRange)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +63,7 @@ extension NexusTests {
|
||||||
("testComponentRetrieval", testComponentRetrieval),
|
("testComponentRetrieval", testComponentRetrieval),
|
||||||
("testComponentUniqueness", testComponentUniqueness),
|
("testComponentUniqueness", testComponentUniqueness),
|
||||||
("testEntityCreate", testEntityCreate),
|
("testEntityCreate", testEntityCreate),
|
||||||
("testEntityDestroy", testEntityDestroy),
|
("testEntityDestroy", testEntityDestroy)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ extension SingleTests {
|
||||||
("testSingleCreation", testSingleCreation),
|
("testSingleCreation", testSingleCreation),
|
||||||
("testSingleCreationOnExistingFamilyMember", testSingleCreationOnExistingFamilyMember),
|
("testSingleCreationOnExistingFamilyMember", testSingleCreationOnExistingFamilyMember),
|
||||||
("testSingleEntityAndComponentCreation", testSingleEntityAndComponentCreation),
|
("testSingleEntityAndComponentCreation", testSingleEntityAndComponentCreation),
|
||||||
("testSingleReuse", testSingleReuse),
|
("testSingleReuse", testSingleReuse)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ extension SparseSetTests {
|
||||||
("testSparseSetRemoveAndAdd", testSparseSetRemoveAndAdd),
|
("testSparseSetRemoveAndAdd", testSparseSetRemoveAndAdd),
|
||||||
("testSparseSetRemoveNonPresent", testSparseSetRemoveNonPresent),
|
("testSparseSetRemoveNonPresent", testSparseSetRemoveNonPresent),
|
||||||
("testStartEndIndex", testStartEndIndex),
|
("testStartEndIndex", testStartEndIndex),
|
||||||
("testSubscript", testSubscript),
|
("testSubscript", testSubscript)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,7 +104,7 @@ extension SystemsTests {
|
||||||
// `swift test --generate-linuxmain`
|
// `swift test --generate-linuxmain`
|
||||||
// to regenerate.
|
// to regenerate.
|
||||||
static let __allTests__SystemsTests = [
|
static let __allTests__SystemsTests = [
|
||||||
("testSystemsUpdate", testSystemsUpdate),
|
("testSystemsUpdate", testSystemsUpdate)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ public func __allTests() -> [XCTestCaseEntry] {
|
||||||
testCase(NexusTests.__allTests__NexusTests),
|
testCase(NexusTests.__allTests__NexusTests),
|
||||||
testCase(SingleTests.__allTests__SingleTests),
|
testCase(SingleTests.__allTests__SingleTests),
|
||||||
testCase(SparseSetTests.__allTests__SparseSetTests),
|
testCase(SparseSetTests.__allTests__SparseSetTests),
|
||||||
testCase(SystemsTests.__allTests__SystemsTests),
|
testCase(SystemsTests.__allTests__SystemsTests)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue