Skip to content

Commit

Permalink
Fix access level
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreffs committed Feb 1, 2022
1 parent 988de72 commit fdbcb35
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Sources/Assimp/Assimp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
@_implementationOnly import CAssimp

public enum Assimp {
static func canImportFileExtension(_ fileExtension: String) -> Bool { aiGetImporterDesc(fileExtension.lowercased()) != nil }
public static func canImportFileExtension(_ fileExtension: String) -> Bool { aiGetImporterDesc(fileExtension.lowercased()) != nil }

static func getImporterDescriptor(for fileExtension: String) -> AiImporterDesc? { AiImporterDesc(aiGetImporterDesc(fileExtension.lowercased())?.pointee) }
public static func getImporterDescriptor(for fileExtension: String) -> AiImporterDesc? { AiImporterDesc(aiGetImporterDesc(fileExtension.lowercased())?.pointee) }

static func importFormats() -> [AiImporterDesc] {
public static func importFormats() -> [AiImporterDesc] {
let count = aiGetImportFormatCount()

guard count > 0 else {
Expand All @@ -23,11 +23,11 @@ public enum Assimp {
.compactMap { AiImporterDesc(aiGetImportFormatDescription($0)?.pointee) }
}

static func importFileExtensions() -> [String] {
public static func importFileExtensions() -> [String] {
importFormats().flatMap(\.fileExtensions).sorted()
}

static func exportFormats() -> [AiExporterDesc] {
public static func exportFormats() -> [AiExporterDesc] {
let count = aiGetExportFormatCount()

guard count > 0 else {
Expand All @@ -38,7 +38,7 @@ public enum Assimp {
.compactMap { AiExporterDesc(aiGetExportFormatDescription($0)?.pointee) }
}

static func exportFileExtensions() -> [String] {
public static func exportFileExtensions() -> [String] {
exportFormats().map(\.fileExtension).sorted()
}
}
Expand Down
21 changes: 1 addition & 20 deletions Tests/AssimpTests/AssimpTests.swift
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
import XCTest
@testable import Assimp
@_implementationOnly import CAssimp
import Assimp

final class AssimpTests: XCTestCase {

func testVersion() {
XCTAssertEqual(aiGetVersionMajor(), 5)
XCTAssertNotNil(aiGetVersionMinor())
XCTAssertNotNil(aiGetVersionRevision())
}

func testFailingInitializer() {
XCTAssertThrowsError(try AiScene(file: "<no useful path>"))
}

func testVec3fFromAiVector3D() {
let vec3f = aiVector3D(x: 1.2, y: 3.4, z: 5.6).vector
XCTAssertEqual(vec3f, SIMD3<Float>(1.2, 3.4, 5.6))
XCTAssertEqual(SIMD3<Float>(aiVector3D(x: 5.6, y: 3.4, z: 1.2)), SIMD3<Float>(5.6, 3.4, 1.2))
}

func testVec2fFromAiVector2D() {
let vec2f = aiVector2D(x: 1.2, y: 3.4).vector
XCTAssertEqual(vec2f, SIMD2<Float>(1.2, 3.4))
XCTAssertEqual(SIMD2<Float>(aiVector2D(x: 5.6, y: 3.4)), SIMD2<Float>(5.6, 3.4))
}

func testImportFormats() {
XCTAssertTrue(Assimp.canImportFileExtension("obj"))
XCTAssertTrue(Assimp.canImportFileExtension("dae"))
Expand Down
23 changes: 23 additions & 0 deletions Tests/AssimpTests/InternalTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import XCTest
@testable import Assimp
@_implementationOnly import CAssimp

final class InternalTests: XCTestCase {
func testVersion() {
XCTAssertEqual(aiGetVersionMajor(), 5)
XCTAssertNotNil(aiGetVersionMinor())
XCTAssertNotNil(aiGetVersionRevision())
}

func testVec3fFromAiVector3D() {
let vec3f = aiVector3D(x: 1.2, y: 3.4, z: 5.6).vector
XCTAssertEqual(vec3f, SIMD3<Float>(1.2, 3.4, 5.6))
XCTAssertEqual(SIMD3<Float>(aiVector3D(x: 5.6, y: 3.4, z: 1.2)), SIMD3<Float>(5.6, 3.4, 1.2))
}

func testVec2fFromAiVector2D() {
let vec2f = aiVector2D(x: 1.2, y: 3.4).vector
XCTAssertEqual(vec2f, SIMD2<Float>(1.2, 3.4))
XCTAssertEqual(SIMD2<Float>(aiVector2D(x: 5.6, y: 3.4)), SIMD2<Float>(5.6, 3.4))
}
}

0 comments on commit fdbcb35

Please sign in to comment.