         }
     }
     
+    func testSubtractOperator() {
+        // NDArray and scalar
+        do {
+            let a = NDArray<Int>(shape: [2, 2], elements: [1, 2, 3, 4])
+            XCTAssertEqual(a - 1, NDArray(shape: [2, 2], elements: [0, 1, 2, 3]))
+            XCTAssertEqual(1 - a, NDArray(shape: [2, 2], elements: [0, -1, -2, -3]))
+        }
+        do {
+            let a = NDArray<Double>(shape: [2, 2], elements: [1, 2, 3, 4])
+            XCTAssertEqualWithAccuracy(a - 1, NDArray(shape: [2, 2], elements: [0, 1, 2, 3]))
+            XCTAssertEqualWithAccuracy(1 - a, NDArray(shape: [2, 2], elements: [0, -1, -2, -3]))
+        }
+        
+        // NDArray and NDArray
+        do {
+            let a = NDArray<Int>(shape: [2, 2], elements: [1, 2, 3, 4])
+            let b = NDArray<Int>(shape: [2, 2], elements: [-1, 0, 1, 0])
+            XCTAssertEqual(a - b, NDArray(shape: [2, 2], elements: [2, 2, 2, 4]))
+        }
+        do {
+            let a = NDArray<Double>(shape: [2, 2], elements: [1, 2, 3, 4])
+            let b = NDArray<Double>(shape: [2, 2], elements: [-1, 0, 1, 0])
+            XCTAssertEqualWithAccuracy(a - b, NDArray(shape: [2, 2], elements: [2, 2, 2, 4]))
+        }
+    }
+    
     func testMultiply() {
         // NDArray and scalar
         do {

        }
    }
    
    func testDivide() {
        // NDArray and scalar
        do {

        }
    }
    
    func testDivideOperator() {
        // NDArray and scalar
        do {
            let a = NDArray<Int>(shape: [2, 2], elements: [1, 2, 3, 4])
            XCTAssertEqual(a / 2, NDArray(shape: [2, 2], elements: [0, 1, 1, 2]))
            XCTAssertEqual(2 / a, NDArray(shape: [2, 2], elements: [2, 1, 0, 0]))
        }
        do {
            let a = NDArray<Double>(shape: [2, 2], elements: [1, 2, 3, 4])
            XCTAssertEqualWithAccuracy(a / 2, NDArray(shape: [2, 2], elements: [0.5, 1.0, 1.5, 2.0]))
            XCTAssertEqualWithAccuracy(2 / a, NDArray(shape: [2, 2], elements: [2.0, 1.0, 2.0/3.0, 0.5]))
        }
        
        // NDArray and NDArray
        do {
            let a = NDArray<Int>(shape: [2, 2], elements: [1, 2, 3, 4])
            let b = NDArray<Int>(shape: [2, 2], elements: [-1, 2, 6, 1])
            XCTAssertEqual(a / b, NDArray(shape: [2, 2], elements: [-1, 1, 0, 4]))
        }
        do {
            let a = NDArray<Double>(shape: [2, 2], elements: [1, 2, 3, 4])
            let b = NDArray<Double>(shape: [2, 2], elements: [-1, 2, 6, 1])
            XCTAssertEqualWithAccuracy(a / b, NDArray(shape: [2, 2], elements: [-1, 1, 0.5, 4]))
        }
    }
    
    func testModulo() {
        // NDArray and scalar
        do {
