Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix * operator which would set value not just for multiplier but also for constant #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EasyPeasy/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public extension CGFloat {
- returns: The resulting `Constant` struct
*/
public static prefix func * (rhs: CGFloat) -> Constant {
return Constant(value: rhs, relation: .equal, multiplier: rhs)
return Constant(value: 0, relation: .equal, multiplier: rhs)
}

/**
Expand Down
10 changes: 5 additions & 5 deletions Example/Tests/CompoundAttributeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CompoundAttributeTests: XCTestCase {

// then
for attribute in sizeAttribute.attributes {
XCTAssertTrue(attribute.constant.value == 2.0)
XCTAssertTrue(attribute.constant.value == 0.0)
XCTAssertTrue(attribute.constant.relation == .equal)
XCTAssertTrue(attribute.constant.multiplier == 2.0)
}
Expand Down Expand Up @@ -173,7 +173,7 @@ class CompoundAttributeTests: XCTestCase {

// then
for attribute in edgesAttribute.attributes {
XCTAssertTrue(attribute.constant.value == 2.0)
XCTAssertTrue(attribute.constant.value == 0.0)
XCTAssertTrue(attribute.constant.relation == .equal)
XCTAssertTrue(attribute.constant.multiplier == 2.0)
}
Expand Down Expand Up @@ -248,7 +248,7 @@ class CompoundAttributeTests: XCTestCase {

// then
for attribute in centerAttribute.attributes {
XCTAssertTrue(attribute.constant.value == 2.0)
XCTAssertTrue(attribute.constant.value == 0.0)
XCTAssertTrue(attribute.constant.relation == .equal)
XCTAssertTrue(attribute.constant.multiplier == 2.0)
}
Expand Down Expand Up @@ -315,7 +315,7 @@ class CompoundAttributeTests: XCTestCase {

// then
for attribute in centerWithinMarginsAttribute.attributes {
XCTAssertTrue(attribute.constant.value == 2.0)
XCTAssertTrue(attribute.constant.value == 0.0)
XCTAssertTrue(attribute.constant.relation == .equal)
XCTAssertTrue(attribute.constant.multiplier == 2.0)
}
Expand Down Expand Up @@ -382,7 +382,7 @@ class CompoundAttributeTests: XCTestCase {

// then
for attribute in marginsAttribute.attributes {
XCTAssertTrue(attribute.constant.value == 2.0)
XCTAssertTrue(attribute.constant.value == 0.0)
XCTAssertTrue(attribute.constant.relation == .equal)
XCTAssertTrue(attribute.constant.multiplier == 2.0)
}
Expand Down
4 changes: 2 additions & 2 deletions Example/Tests/ConstantTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ConstantTests: XCTestCase {
let constant = (*5)

// then
XCTAssertTrue(constant.value == 5)
XCTAssertTrue(constant.value == 0)
XCTAssertTrue(constant.relation == .equal)
XCTAssertTrue(constant.multiplier == 5.0)
}
Expand Down Expand Up @@ -137,7 +137,7 @@ class ConstantTests: XCTestCase {
// then
XCTAssertTrue(greaterThanValue == 200.0)
XCTAssertTrue(lessThanValue == 200.0)
XCTAssertTrue(multipliedByValue == 200.0)
XCTAssertTrue(multipliedByValue == 0.0)
XCTAssertTrue(equalToValue == 200.0)
XCTAssertTrue(equalToPrefValue == 200.0)
}
Expand Down