Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Commit

Permalink
Add Addable/Subtractable tests.
Browse files Browse the repository at this point in the history
Reviewers: O2 Material Motion, O4 Material Apple platform reviewers, #material_motion, chuga

Reviewed By: O4 Material Apple platform reviewers, chuga

Tags: #material_motion

Differential Revision: http://codereview.cc/D2902
  • Loading branch information
jverkoey committed Mar 22, 2017
1 parent 2b647ad commit f91a445
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
Expand Up @@ -40,6 +40,8 @@
6686F01C1E77293100F97CC4 /* MotionRuntimeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6686F01B1E77293100F97CC4 /* MotionRuntimeTests.swift */; };
6686F01E1E772F1700F97CC4 /* ExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6686F01D1E772F1700F97CC4 /* ExampleViewController.swift */; };
6695126C1E8209FB00D8868D /* _rememberTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6695126B1E8209FB00D8868D /* _rememberTests.swift */; };
669512721E82E63300D8868D /* AddableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669512711E82E63300D8868D /* AddableTests.swift */; };
669512741E82E68900D8868D /* SubtractableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 669512731E82E68900D8868D /* SubtractableTests.swift */; };
66BD3CCB1E8046AD00AA413C /* MaterialExpansionExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66BD3CCA1E8046AD00AA413C /* MaterialExpansionExample.swift */; };
66DDFD0D1E71F0F100AA46B7 /* DraggableExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66DDFD0C1E71F0F100AA46B7 /* DraggableExample.swift */; };
66DDFD121E71F39700AA46B7 /* ExampleViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66DDFD111E71F39700AA46B7 /* ExampleViews.swift */; };
Expand Down Expand Up @@ -101,6 +103,8 @@
6686F01D1E772F1700F97CC4 /* ExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleViewController.swift; sourceTree = "<group>"; };
6686F0201E79845E00F97CC4 /* ReactivePlayground.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = ReactivePlayground.playground; sourceTree = "<group>"; };
6695126B1E8209FB00D8868D /* _rememberTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = _rememberTests.swift; sourceTree = "<group>"; };
669512711E82E63300D8868D /* AddableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddableTests.swift; sourceTree = "<group>"; };
669512731E82E68900D8868D /* SubtractableTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubtractableTests.swift; sourceTree = "<group>"; };
66BD3CCA1E8046AD00AA413C /* MaterialExpansionExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MaterialExpansionExample.swift; path = ../../MaterialExpansionExample.swift; sourceTree = "<group>"; };
66DDFD0C1E71F0F100AA46B7 /* DraggableExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DraggableExample.swift; path = ../../DraggableExample.swift; sourceTree = "<group>"; };
66DDFD111E71F39700AA46B7 /* ExampleViews.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleViews.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -207,6 +211,7 @@
6627FC151DF7BC7D003DB567 /* operator */,
66090B881E046CE600B1D598 /* plans */,
6627FC1F1DF7C76C003DB567 /* properties */,
669512701E82E62500D8868D /* protocols */,
6627FC0D1DF7B1A2003DB567 /* MotionObservableTests.swift */,
6627FC1D1DF7BF59003DB567 /* ReactivePropertyTests.swift */,
6686F01B1E77293100F97CC4 /* MotionRuntimeTests.swift */,
Expand Down Expand Up @@ -320,6 +325,15 @@
path = ../../supplemental;
sourceTree = "<group>";
};
669512701E82E62500D8868D /* protocols */ = {
isa = PBXGroup;
children = (
669512711E82E63300D8868D /* AddableTests.swift */,
669512731E82E68900D8868D /* SubtractableTests.swift */,
);
path = protocols;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -557,10 +571,12 @@
buildActionMask = 2147483647;
files = (
6627FC1A1DF7BC7D003DB567 /* _mapTests.swift in Sources */,
669512741E82E68900D8868D /* SubtractableTests.swift in Sources */,
6627FC1E1DF7BF59003DB567 /* ReactivePropertyTests.swift in Sources */,
6627FC2F1DFFAEB7003DB567 /* CGPointTests.swift in Sources */,
6686F01C1E77293100F97CC4 /* MotionRuntimeTests.swift in Sources */,
6695126C1E8209FB00D8868D /* _rememberTests.swift in Sources */,
669512721E82E63300D8868D /* AddableTests.swift in Sources */,
6627FC1B1DF7BC7D003DB567 /* _operatorTests.swift in Sources */,
66090B8A1E046CE600B1D598 /* Spring.swift in Sources */,
6627FC0E1DF7B1A2003DB567 /* MotionObservableTests.swift in Sources */,
Expand Down
28 changes: 28 additions & 0 deletions tests/unit/protocols/AddableTests.swift
@@ -0,0 +1,28 @@
/*
Copyright 2017-present The Material Motion Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import XCTest
import MaterialMotion

class AddableTests: XCTestCase {

func testCGPoint() {
let point1 = CGPoint(x: 1, y: 2)
let point2 = CGPoint(x: 3, y: 4)

XCTAssertEqual(point1 + point2, CGPoint(x: 4, y: 6))
}
}
42 changes: 42 additions & 0 deletions tests/unit/protocols/SubtractableTests.swift
@@ -0,0 +1,42 @@
/*
Copyright 2017-present The Material Motion Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import XCTest
import MaterialMotion

class SubtractableTests: XCTestCase {

func testCGPoint() {
let value1 = CGPoint(x: 1, y: 2)
let value2 = CGPoint(x: 4, y: 3)

XCTAssertEqual(value1 - value2, CGPoint(x: -3, y: -1))
}

func testCGSize() {
let value1 = CGSize(width: 1, height: 2)
let value2 = CGSize(width: 4, height: 3)

XCTAssertEqual(value1 - value2, CGSize(width: -3, height: -1))
}

func testCGRect() {
let value1 = CGRect(x: 1, y: 2, width: 3, height: 4)
let value2 = CGRect(x: 8, y: 7, width: 6, height: 5)

XCTAssertEqual(value1 - value2, CGRect(x: -7, y: -5, width: -3, height: -1))
}
}

0 comments on commit f91a445

Please sign in to comment.