    import XCTest
    @testable import SklvConstraints
    
    final class HeightTests: XCTestCase {
        
        func testHeight() {
            let view = UIView()
            let value: CGFloat = 100
            
            view.height(value)
            
            let constraint = view.constraints[0]
            
            XCTAssertIdentical(constraint.firstItem, view)
            XCTAssertIdentical(constraint.firstAnchor, view.heightAnchor)
            
            XCTAssertEqual(constraint.relation, NSLayoutConstraint.Relation.equal)
            XCTAssertEqual(constraint.priority, UILayoutPriority.required)
            
            XCTAssertEqual(constraint.constant, value)
            XCTAssertTrue(constraint.isActive)
        }
        
        func testHeightMax() {
            let view = UIView()
            let value: CGFloat = 100
            
            view.height(max: value)
            
            let constraint = view.constraints[0]
            
            XCTAssertIdentical(constraint.firstItem, view)
            XCTAssertIdentical(constraint.firstAnchor, view.heightAnchor)
            
            XCTAssertEqual(constraint.relation, NSLayoutConstraint.Relation.lessThanOrEqual)
            XCTAssertEqual(constraint.priority, UILayoutPriority.required)
            
            XCTAssertEqual(constraint.constant, value)
            XCTAssertTrue(constraint.isActive)
        }
        
        func testHeightMin() {
            let view = UIView()
            let value: CGFloat = 100
            
            view.height(min: value)
            
            let constraint = view.constraints[0]
            
            XCTAssertIdentical(constraint.firstItem, view)
            XCTAssertIdentical(constraint.firstAnchor, view.heightAnchor)
            
            XCTAssertEqual(constraint.relation, NSLayoutConstraint.Relation.greaterThanOrEqual)
            XCTAssertEqual(constraint.priority, UILayoutPriority.required)
            
            XCTAssertEqual(constraint.constant, value)
            XCTAssertTrue(constraint.isActive)
        }
        
        func testHeightEqualTo() {
            let superview = UIView()
            let subview1 = UIView()
            let subview2 = UIView()
            let value: CGFloat = 2
            
            superview.addSubview(subview1)
            superview.addSubview(subview2)
            subview1.height(equalHeightTo: subview2, multiplier: value)
            
            let constraint = superview.constraints[0]
            
            XCTAssertIdentical(constraint.firstItem, subview1)
            XCTAssertIdentical(constraint.secondItem, subview2)
            
            XCTAssertIdentical(constraint.firstAnchor, subview1.heightAnchor)
            XCTAssertIdentical(constraint.secondAnchor, subview2.heightAnchor)
            
            XCTAssertEqual(constraint.relation, NSLayoutConstraint.Relation.equal)
            XCTAssertEqual(constraint.priority, UILayoutPriority.required)
            
            XCTAssertEqual(constraint.multiplier, value)
            XCTAssertTrue(constraint.isActive)
        }
        
        func testHeightAspectRatio() {
            let view = UIView()
            let value: CGFloat = 2
            
            view.heightToWidth(aspectRatio: value)
            
            let constraint = view.constraints[0]
            
            XCTAssertIdentical(constraint.firstItem, view)
            XCTAssertIdentical(constraint.secondItem, view)
            
            XCTAssertIdentical(constraint.firstAnchor, view.heightAnchor)
            XCTAssertIdentical(constraint.secondAnchor, view.widthAnchor)
            
            XCTAssertEqual(constraint.relation, NSLayoutConstraint.Relation.equal)
            XCTAssertEqual(constraint.priority, UILayoutPriority.required)
            
            XCTAssertEqual(constraint.multiplier, value)
            XCTAssertTrue(constraint.isActive)
        }
        
    }
