         var stringSize = "{105.7, 24.3}"
         var stringRect = "{{0.6, 5.4}, {105.7, 24.3}}"
         
-        let expectedPoint = NSPoint(x: CGFloat(0.6), y: CGFloat(5.4))
+        let expectedPoint = NSMakePoint(CGFloat(0.6), CGFloat(5.4))
         var point = NSPointFromString(stringPoint)
         XCTAssertTrue(_NSPoint(expectedPoint, equalsToPoint: point),
                        "\(NSStringFromPoint(point)) is not equal to expected \(NSStringFromPoint(expectedPoint))")
         
-        let expectedSize = NSSize(width: CGFloat(105.7), height: CGFloat(24.3))
+        let expectedSize = NSMakeSize(CGFloat(105.7), CGFloat(24.3))
         var size = NSSizeFromString(stringSize)
         XCTAssertTrue(_NSSize(expectedSize, equalsToSize: size),
                        "\(NSStringFromSize(size)) is not equal to expected \(NSStringFromSize(expectedSize))")
         
-        let expectedRect = NSRect(x: CGFloat(0.6), y: CGFloat(5.4), width: CGFloat(105.7), height: CGFloat(24.3))
+        let expectedRect = NSMakeRect(CGFloat(0.6), CGFloat(5.4), CGFloat(105.7), CGFloat(24.3))
         var rect = NSRectFromString(stringRect)
         XCTAssertTrue(_NSRect(expectedRect, equalsToRect: rect),
                        "\(NSStringFromRect(rect)) is not equal to expected \(NSStringFromRect(expectedRect))")

    func test_NSDivideRect() {

        // divide empty rect
        var inRect = NSRect.zero
        var slice = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        var remainder = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        NSDivideRect(inRect, &slice, &remainder, CGFloat(0.0), .maxX)
        var expectedSlice = NSRect.zero
        var expectedRemainder = NSRect.zero
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MinX edge
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, CGFloat(10.0), .minX)
        expectedSlice = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(10.0), height: CGFloat(35.0))
        expectedRemainder = NSRect(x: CGFloat(10.0), y: CGFloat(-5.0), width: CGFloat(15.0), height: CGFloat(35.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MinX edge with amount > width
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, inRect.width + CGFloat(1.0), .minX)
        expectedSlice = inRect
        expectedRemainder = NSRect(x: CGFloat(25.0), y: CGFloat(-5.0), width: CGFloat(0.0), height: CGFloat(35.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MinY edge
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, CGFloat(10.0), .minY)
        expectedSlice = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(10.0))
        expectedRemainder = NSRect(x: CGFloat(0.0), y: CGFloat(5.0), width: CGFloat(25.0), height: CGFloat(25.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MinY edge with amount > height
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, inRect.height + CGFloat(1.0), .minY)
        expectedSlice = inRect
        expectedRemainder = NSRect(x: CGFloat(0.0), y: CGFloat(30.0), width: CGFloat(25.0), height: CGFloat(0.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MaxX edge
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, CGFloat(10.0), .maxX)
        expectedSlice = NSRect(x: CGFloat(15.0), y: CGFloat(-5.0), width: CGFloat(10.0), height: CGFloat(35.0))
        expectedRemainder = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(15.0), height: CGFloat(35.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MaxX edge with amount > width
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, inRect.width + CGFloat(1.0), .maxX)
        expectedSlice = inRect
        expectedRemainder = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(0.0), height: CGFloat(35.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MaxY edge
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, CGFloat(10.0), .maxY)
        expectedSlice = NSRect(x: CGFloat(0.0), y: CGFloat(20.0), width: CGFloat(25.0), height: CGFloat(10.0))
        expectedRemainder = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(25.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)

        // divide rect by MaxY edge with amount > height
        inRect = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(35.0))
        slice = NSRect.zero
        remainder = NSRect.zero
        NSDivideRect(inRect, &slice, &remainder, inRect.height + CGFloat(1.0), .maxY)
        expectedSlice = inRect
        expectedRemainder = NSRect(x: CGFloat(0.0), y: CGFloat(-5.0), width: CGFloat(25.0), height: CGFloat(0.0))
        XCTAssertEqual(slice, expectedSlice)
        XCTAssertEqual(remainder, expectedRemainder)
    }
    
    func test_EncodeToNSString() {
        let referenceRect = NSRect(x: CGFloat(0.6), y: CGFloat(5.4), width: CGFloat(105.7), height: CGFloat(24.3))
        
        var expectedString = "{0.6, 5.4}"
        var string = NSStringFromPoint(referenceRect.origin)

    
    func test_DecodeGarbageFromNSString() {
        var stringRect = "-0.6a5.4das-105.7bfh24.3dfas;hk312}}"
        var expectedRect = NSMakeRect(CGFloat(-0.6), CGFloat(5.4), CGFloat(-105.7), CGFloat(24.3))
        var rect = NSRectFromString(stringRect)
        XCTAssertTrue(_NSRect(expectedRect, equalsToRect: rect),
                       "\(NSStringFromRect(rect)) is not equal to expected \(NSStringFromRect(expectedRect))")

        stringRect = "-0.6a5.4da}}"
        expectedRect = NSMakeRect(CGFloat(-0.6), CGFloat(5.4), CGFloat(0.0), CGFloat(0.0))
        rect = NSRectFromString(stringRect)
        XCTAssertTrue(_NSRect(expectedRect, equalsToRect: rect),
                       "\(NSStringFromRect(rect)) is not equal to expected \(NSStringFromRect(expectedRect))")
