|
212 | 212 | (r/ungroup (r/group [1 6 1 8] (r/fn [e] e))) [{:group 1, :reduction [1 1]}
|
213 | 213 | {:group 6, :reduction [6]}
|
214 | 214 | {:group 8, :reduction [8]}]
|
| 215 | + (r/reduce [1] (r/fn [a b] (r/add a b))) 1 |
| 216 | + (r/reduce [1 6 1 8] (r/fn [a b] (r/add a b))) 16 |
215 | 217 | (r/count [1 6 1 8]) 4
|
216 | 218 | (r/count "asdf") 4
|
217 | 219 | (r/count {:a 1 :b 2 :c 3}) 3
|
|
313 | 315 | (r/has-fields a :y) [(first a)])))
|
314 | 316 |
|
315 | 317 | (testing "literal-values"
|
316 |
| - (with-open [conn (r/connect)] |
317 |
| - (is (= (r/run (r/object :a 1) conn) {:a 1})) |
318 |
| - (is (= (r/run (r/keys (r/object :a 1)) conn) ["a"])) |
319 |
| - (is (= (r/run (r/values (r/object :a 1)) conn) [1])))))) |
| 318 | + (are [term result] (= (r/run term conn) result) |
| 319 | + (r/object :a 1) {:a 1} |
| 320 | + (r/keys (r/object :a 1)) ["a"] |
| 321 | + (r/values (r/object :a 1)) [1])))) |
320 | 322 |
|
321 | 323 | (deftest string-manipulation
|
322 | 324 | (with-open [conn (r/connect)]
|
|
392 | 394 | (r/coerce-to "1" "NUMBER") 1
|
393 | 395 | (r/type-of [1 2 3]) "ARRAY"
|
394 | 396 | (r/type-of {:number 42}) "OBJECT"
|
395 |
| - (r/json "{\"number\":42}") {:number 42}))) |
| 397 | + (r/json "{\"number\":42}") {:number 42}) |
| 398 | + (is (= (:url (r/run (r/http "http://httpbin.org/get") conn)) "http://httpbin.org/get")))) |
396 | 399 |
|
397 | 400 | (deftest math-and-logic
|
398 | 401 | (with-open [conn (r/connect)]
|
|
647 | 650 | :image (bs/to-byte-array file)})
|
648 | 651 | (r/run conn))
|
649 | 652 | (let [resp (-> (r/table "pokedex") (r/run conn) first :image)]
|
650 |
| - (is (= (String. resp "UTF-8") (String. (bs/to-byte-array file) "UTF-8"))))))) |
| 653 | + (is (= (String. ^bytes resp "UTF-8") (String. (bs/to-byte-array file) "UTF-8"))))))) |
0 commit comments