Change the indentation of a test

This commit is contained in:
Kodi Arfer 2019-12-26 09:14:02 -05:00
parent 63881e7851
commit 2074e4bd2f

View File

@ -306,40 +306,40 @@
(defn test-augassign [] (defn test-augassign []
(setv b 2 c 3 d 4) (setv b 2 c 3 d 4)
(defmacro same-as [expr1 expr2 expected-value] (defmacro same-as [expr1 expr2 expected-value]
`(do `(do
(setv a 4) (setv a 4)
~expr1 ~expr1
(setv expr1-value a) (setv expr1-value a)
(setv a 4) (setv a 4)
~expr2 ~expr2
(assert (= expr1-value a ~expected-value)))) (assert (= expr1-value a ~expected-value))))
(same-as (+= a b c d) (+= a (+ b c d)) 13) (same-as (+= a b c d) (+= a (+ b c d)) 13)
(same-as (-= a b c d) (-= a (+ b c d)) -5) (same-as (-= a b c d) (-= a (+ b c d)) -5)
(same-as (*= a b c d) (*= a (* b c d)) 96) (same-as (*= a b c d) (*= a (* b c d)) 96)
(same-as (**= a b c) (**= a (** b c)) 65,536) (same-as (**= a b c) (**= a (** b c)) 65,536)
(same-as (/= a b c d) (/= a (* b c d)) (/ 1 6)) (same-as (/= a b c d) (/= a (* b c d)) (/ 1 6))
(same-as (//= a b c d) (//= a (* b c d)) 0) (same-as (//= a b c d) (//= a (* b c d)) 0)
(same-as (<<= a b c d) (<<= a (+ b c d)) 0b10_00000_00000) (same-as (<<= a b c d) (<<= a (+ b c d)) 0b10_00000_00000)
(same-as (>>= a b c d) (>>= a (+ b c d)) 0) (same-as (>>= a b c d) (>>= a (+ b c d)) 0)
(same-as (&= a b c d) (&= a (& b c d)) 0) (same-as (&= a b c d) (&= a (& b c d)) 0)
(same-as (|= a b c d) (|= a (| b c d)) 0b111) (same-as (|= a b c d) (|= a (| b c d)) 0b111)
(defclass C [object] (defclass C [object]
(defn __init__ [self content] (setv self.content content)) (defn __init__ [self content] (setv self.content content))
(defn __matmul__ [self other] (C (+ self.content other.content)))) (defn __matmul__ [self other] (C (+ self.content other.content))))
(setv a (C "a") b (C "b") c (C "c") d (C "d")) (setv a (C "a") b (C "b") c (C "c") d (C "d"))
(@= a b c d) (@= a b c d)
(assert (= a.content "abcd")) (assert (= a.content "abcd"))
(setv a (C "a")) (setv a (C "a"))
(@= a (@ b c d)) (@= a (@ b c d))
(assert (= a.content "abcd")) (assert (= a.content "abcd"))
(setv a 15) (setv a 15)
(%= a 9) (%= a 9)
(assert (= a 6)) (assert (= a 6))
(setv a 0b1100) (setv a 0b1100)
(^= a 0b1010) (^= a 0b1010)
(assert (= a 0b0110))) (assert (= a 0b0110)))