Skip to content

Commit

Permalink
#50 Working on code generator
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed May 31, 2018
1 parent a443fd5 commit c66588e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
14 changes: 7 additions & 7 deletions Sources/CompanyIdentifierExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public extension CompanyIdentifier {
}

/// Qualcomm Technologies International, Ltd. (QTIL) (`10`)
static var qualcommTechnologiesInternationalQtil: CompanyIdentifier {
static var qualcommTechnologiesInternational: CompanyIdentifier {
return CompanyIdentifier(rawValue: 10)
}

Expand Down Expand Up @@ -2068,7 +2068,7 @@ public extension CompanyIdentifier {
}

/// Cokiya Incorporated (`412`)
static var cokiyaorporated: CompanyIdentifier {
static var cokiya: CompanyIdentifier {
return CompanyIdentifier(rawValue: 412)
}

Expand Down Expand Up @@ -3713,7 +3713,7 @@ public extension CompanyIdentifier {
}

/// Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 ) (`741`)
static var espressiforporated乐鑫信息科技上海有限公司: CompanyIdentifier {
static var espressif乐鑫信息科技上海有限公司: CompanyIdentifier {
return CompanyIdentifier(rawValue: 741)
}

Expand Down Expand Up @@ -4503,7 +4503,7 @@ public extension CompanyIdentifier {
}

/// Kronos Incorporated (`899`)
static var kronosorporated: CompanyIdentifier {
static var kronos: CompanyIdentifier {
return CompanyIdentifier(rawValue: 899)
}

Expand Down Expand Up @@ -5343,7 +5343,7 @@ public extension CompanyIdentifier {
}

/// iMicroMed Incorporated (`1067`)
static var imicromedorporated: CompanyIdentifier {
static var imicromed: CompanyIdentifier {
return CompanyIdentifier(rawValue: 1067)
}

Expand Down Expand Up @@ -7223,7 +7223,7 @@ public extension CompanyIdentifier {
}

/// Axiomware Systems Incorporated (`1443`)
static var axiomwareSystemsorporated: CompanyIdentifier {
static var axiomwareSystems: CompanyIdentifier {
return CompanyIdentifier(rawValue: 1443)
}

Expand Down Expand Up @@ -7533,7 +7533,7 @@ public extension CompanyIdentifier {
}

/// Human, Incorporated (`1505`)
static var humanOrporated: CompanyIdentifier {
static var human: CompanyIdentifier {
return CompanyIdentifier(rawValue: 1505)
}

Expand Down
7 changes: 5 additions & 2 deletions Tests/BluetoothTests/BluetoothTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,12 @@ final class BluetoothTests: XCTestCase {
guard let memberName = memberNameCache[identifier]
else { XCTFail("No extension generated for \(identifier)"); return }

let stringLiteral = name.replacingOccurrences(of: "\"", with: "\\\"")

🖨(" /// \(name)")
🖨(" XCTAssertEqual(CompanyIdentifier.\(memberName).rawValue, \(identifier))")
🖨(" XCTAssertEqual(CompanyIdentifier.\(memberName).name, \"\(name)\")")
🖨(" XCTAssertEqual(CompanyIdentifier.\(memberName).description, \"\(name)\")")
🖨(" XCTAssertEqual(CompanyIdentifier.\(memberName).name, \"\(stringLiteral)\")")
🖨(" XCTAssertEqual(CompanyIdentifier.\(memberName).description, \"\(stringLiteral)\")")
🖨("")
}

Expand Down Expand Up @@ -560,6 +562,7 @@ func uppercaseFirstLetter(_ string: String) -> String {
func sanitize(name: String) -> String {

var name = name
.replacingOccurrences(of: "\"", with: "")
.replacingOccurrences(of: "3D ", with: "uuid3D")
.replacingOccurrences(of: "IF, LLC", with: "ifLLC")
.replacingOccurrences(of: "WHERE, Inc.", with: "whereInc")
Expand Down
46 changes: 23 additions & 23 deletions Tests/BluetoothTests/CompanyIdentifierTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.infineonTechnologies.description, "Infineon Technologies AG")

/// Qualcomm Technologies International, Ltd. (QTIL)
XCTAssertEqual(CompanyIdentifier.qualcommTechnologiesInternationalQtil.rawValue, 10)
XCTAssertEqual(CompanyIdentifier.qualcommTechnologiesInternationalQtil.name, "Qualcomm Technologies International, Ltd. (QTIL)")
XCTAssertEqual(CompanyIdentifier.qualcommTechnologiesInternationalQtil.description, "Qualcomm Technologies International, Ltd. (QTIL)")
XCTAssertEqual(CompanyIdentifier.qualcommTechnologiesInternational.rawValue, 10)
XCTAssertEqual(CompanyIdentifier.qualcommTechnologiesInternational.name, "Qualcomm Technologies International, Ltd. (QTIL)")
XCTAssertEqual(CompanyIdentifier.qualcommTechnologiesInternational.description, "Qualcomm Technologies International, Ltd. (QTIL)")

/// Silicon Wave
XCTAssertEqual(CompanyIdentifier.siliconWave.rawValue, 11)
Expand Down Expand Up @@ -2079,9 +2079,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.cubetechSRO.description, "CUBETECH s.r.o.")

/// Cokiya Incorporated
XCTAssertEqual(CompanyIdentifier.cokiyaorporated.rawValue, 412)
XCTAssertEqual(CompanyIdentifier.cokiyaorporated.name, "Cokiya Incorporated")
XCTAssertEqual(CompanyIdentifier.cokiyaorporated.description, "Cokiya Incorporated")
XCTAssertEqual(CompanyIdentifier.cokiya.rawValue, 412)
XCTAssertEqual(CompanyIdentifier.cokiya.name, "Cokiya Incorporated")
XCTAssertEqual(CompanyIdentifier.cokiya.description, "Cokiya Incorporated")

/// CVS Health
XCTAssertEqual(CompanyIdentifier.cvsHealth.rawValue, 413)
Expand Down Expand Up @@ -3724,9 +3724,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.bytestorm.description, "Bytestorm Ltd.")

/// Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )
XCTAssertEqual(CompanyIdentifier.espressiforporated乐鑫信息科技上海有限公司.rawValue, 741)
XCTAssertEqual(CompanyIdentifier.espressiforporated乐鑫信息科技上海有限公司.name, "Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )")
XCTAssertEqual(CompanyIdentifier.espressiforporated乐鑫信息科技上海有限公司.description, "Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )")
XCTAssertEqual(CompanyIdentifier.espressif乐鑫信息科技上海有限公司.rawValue, 741)
XCTAssertEqual(CompanyIdentifier.espressif乐鑫信息科技上海有限公司.name, "Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )")
XCTAssertEqual(CompanyIdentifier.espressif乐鑫信息科技上海有限公司.description, "Espressif Incorporated ( 乐鑫信息科技(上海)有限公司 )")

/// Unwire
XCTAssertEqual(CompanyIdentifier.unwire.rawValue, 742)
Expand Down Expand Up @@ -4500,8 +4500,8 @@ final class CompanyIdentifierTests: XCTestCase {

/// LLC "MEGA-F service"
XCTAssertEqual(CompanyIdentifier.llcMegaFService.rawValue, 896)
//XCTAssertEqual(CompanyIdentifier.llcMegaFService.name, "LLC "MEGA-F service"")
//XCTAssertEqual(CompanyIdentifier.llcMegaFService.description, "LLC "MEGA-F service"")
XCTAssertEqual(CompanyIdentifier.llcMegaFService.name, "LLC \"MEGA-F service\"")
XCTAssertEqual(CompanyIdentifier.llcMegaFService.description, "LLC \"MEGA-F service\"")

/// Sharp Corporation
XCTAssertEqual(CompanyIdentifier.sharpCorporation.rawValue, 897)
Expand All @@ -4514,9 +4514,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.precisionOutcomes.description, "Precision Outcomes Ltd")

/// Kronos Incorporated
XCTAssertEqual(CompanyIdentifier.kronosorporated.rawValue, 899)
XCTAssertEqual(CompanyIdentifier.kronosorporated.name, "Kronos Incorporated")
XCTAssertEqual(CompanyIdentifier.kronosorporated.description, "Kronos Incorporated")
XCTAssertEqual(CompanyIdentifier.kronos.rawValue, 899)
XCTAssertEqual(CompanyIdentifier.kronos.name, "Kronos Incorporated")
XCTAssertEqual(CompanyIdentifier.kronos.description, "Kronos Incorporated")

/// OCOSMOS Co., Ltd.
XCTAssertEqual(CompanyIdentifier.ocosmos.rawValue, 900)
Expand Down Expand Up @@ -5354,9 +5354,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.bdMedical.description, "BD Medical")

/// iMicroMed Incorporated
XCTAssertEqual(CompanyIdentifier.imicromedorporated.rawValue, 1067)
XCTAssertEqual(CompanyIdentifier.imicromedorporated.name, "iMicroMed Incorporated")
XCTAssertEqual(CompanyIdentifier.imicromedorporated.description, "iMicroMed Incorporated")
XCTAssertEqual(CompanyIdentifier.imicromed.rawValue, 1067)
XCTAssertEqual(CompanyIdentifier.imicromed.name, "iMicroMed Incorporated")
XCTAssertEqual(CompanyIdentifier.imicromed.description, "iMicroMed Incorporated")

/// Ticto N.V.
XCTAssertEqual(CompanyIdentifier.tictoNV.rawValue, 1068)
Expand Down Expand Up @@ -7234,9 +7234,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.adheriumNzLimited.description, "ADHERIUM(NZ) LIMITED")

/// Axiomware Systems Incorporated
XCTAssertEqual(CompanyIdentifier.axiomwareSystemsorporated.rawValue, 1443)
XCTAssertEqual(CompanyIdentifier.axiomwareSystemsorporated.name, "Axiomware Systems Incorporated")
XCTAssertEqual(CompanyIdentifier.axiomwareSystemsorporated.description, "Axiomware Systems Incorporated")
XCTAssertEqual(CompanyIdentifier.axiomwareSystems.rawValue, 1443)
XCTAssertEqual(CompanyIdentifier.axiomwareSystems.name, "Axiomware Systems Incorporated")
XCTAssertEqual(CompanyIdentifier.axiomwareSystems.description, "Axiomware Systems Incorporated")

/// O. E. M. Controls, Inc.
XCTAssertEqual(CompanyIdentifier.oEMControls.rawValue, 1444)
Expand Down Expand Up @@ -7544,9 +7544,9 @@ final class CompanyIdentifierTests: XCTestCase {
XCTAssertEqual(CompanyIdentifier.viperDesign.description, "Viper Design LLC")

/// Human, Incorporated
XCTAssertEqual(CompanyIdentifier.humanOrporated.rawValue, 1505)
XCTAssertEqual(CompanyIdentifier.humanOrporated.name, "Human, Incorporated")
XCTAssertEqual(CompanyIdentifier.humanOrporated.description, "Human, Incorporated")
XCTAssertEqual(CompanyIdentifier.human.rawValue, 1505)
XCTAssertEqual(CompanyIdentifier.human.name, "Human, Incorporated")
XCTAssertEqual(CompanyIdentifier.human.description, "Human, Incorporated")

/// stAPPtronics GmbH
XCTAssertEqual(CompanyIdentifier.stapptronics.rawValue, 1506)
Expand Down

0 comments on commit c66588e

Please sign in to comment.