         XCTAssertEqual(XMLOutput["colorGrayscale"] as? String, "000000FF")
         XCTAssertNil(XMLOutput["colorNotAString"])
 	}
+    
+    func isEqualColors(_ lhs: TestHexColor?,_ rhs: TestHexColor?) -> Bool {
+        switch (lhs?.cgColor.components, rhs?.cgColor.components) {
+        case let (components?, colorComponents?):
+            return components == colorComponents
+        default:
+            return false
+        }
+    }
 }
 
 class Transforms: XMLMappable {

        colorNotAString          <- (map["colorNotAString"], XMLHexColorTransform())
	}
}


		
		let transform = mapper.map(XML: XML)
		
        XCTAssertTrue(isEqualColors(transform?.colorRed, TestHexColor.red))
        XCTAssertTrue(isEqualColors(transform?.colorGreenLowercase, TestHexColor.green))
        XCTAssertTrue(isEqualColors(transform?.colorBlueWithoutHash, TestHexColor.blue))
        XCTAssertTrue(isEqualColors(transform?.color3lenght, TestHexColor.red))
        XCTAssertTrue(isEqualColors(transform?.color4lenght, TestHexColor.red))
        XCTAssertTrue(isEqualColors(transform?.color8lenght, TestHexColor.red))
        XCTAssertNil(transform?.colorInvalidRGBString)
        XCTAssertNil(transform?.colorErrorInScanHex)
        XCTAssertNil(transform?.colorNotAString)
