aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2019-06-20 19:49:34 -0400
committerEduardo Julian2019-06-20 19:49:34 -0400
commitfcee38da766a683ed5569978be153c6e7a8ae0af (patch)
tree8d75d3c70de9f3ec4518a58d88b036207f4cc9d3 /stdlib/source/test
parent67687850677bb34df37d6e9d1a2578d1198108d6 (diff)
Removed the TCP & UDP code for the moment.
It needs to be re-designed with a multi-platform focus in mind.
Diffstat (limited to 'stdlib/source/test')
-rw-r--r--stdlib/source/test/lux/world.lux5
-rw-r--r--stdlib/source/test/lux/world/net/tcp.lux73
-rw-r--r--stdlib/source/test/lux/world/net/udp.lux66
3 files changed, 0 insertions, 144 deletions
diff --git a/stdlib/source/test/lux/world.lux b/stdlib/source/test/lux/world.lux
index b23b29dbe..bfd9e6194 100644
--- a/stdlib/source/test/lux/world.lux
+++ b/stdlib/source/test/lux/world.lux
@@ -4,9 +4,6 @@
["." / #_
["#." binary]
["#." file]
- ["#." net #_
- ["#/." tcp]
- ["#/." udp]]
])
(def: #export test
@@ -14,6 +11,4 @@
($_ _.and
/binary.test
/file.test
- /net/tcp.test
- /net/udp.test
))
diff --git a/stdlib/source/test/lux/world/net/tcp.lux b/stdlib/source/test/lux/world/net/tcp.lux
deleted file mode 100644
index fb4983302..000000000
--- a/stdlib/source/test/lux/world/net/tcp.lux
+++ /dev/null
@@ -1,73 +0,0 @@
-(.module:
- [lux #*
- data/text/format
- ["r" math/random (#+ Random)]
- ["_" test (#+ Test)]
- ["." abstract/monad (#+ do)]
- [control
- ["ex" exception (#+ exception:)]
- ["." io (#+ IO)]
- [concurrency
- ["." promise (#+ Promise Resolver)]
- ["." frp ("#@." functor)]]
- [security
- ["!" capability]]]
- [data
- ["." error (#+ Error)]
- ["." text]]
- [world
- ["." binary]
- ["." net]]]
- {1
- ["." /]}
- [///
- ["_." binary]])
-
-(def: localhost net.Address "127.0.0.1")
-
-(def: port
- (r.Random net.Port)
- (|> r.nat
- (:: r.monad map
- (|>> (n/% 1000)
- (n/+ 8000)))))
-
-(def: #export test
- Test
- (<| (_.context (%name (name-of /._)))
- (do r.monad
- [port ..port
- size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10))))
- from (_binary.binary size)
- to (_binary.binary size)]
- ($_ _.and
- (wrap (do promise.monad
- [#let [[from-worked? from-worked!] (: [(Promise Bit) (Resolver Bit)]
- (promise.promise []))]
- result (promise.future
- (do (error.with io.monad)
- [[close! server] (/.server port)
- #let [_ (frp@map (function (_ client)
- (promise.future
- (do @
- [[trasmission-size transmission] (!.use (:: client read) size)
- #let [_ (io.run (from-worked! (and (n/= size trasmission-size)
- (:: binary.equivalence = from transmission))))]]
- (!.use (:: client write) to))))
- server)]
- client (/.client localhost port)
- _ (!.use (:: client write) from)
- ####################
- [trasmission-size transmission] (!.use (:: client read) size)
- #let [to-worked? (and (n/= size trasmission-size)
- (:: binary.equivalence = to transmission))]
- ####################
- _ (!.use (:: client close) [])
- _ (: (IO (Error Bit))
- (error.lift io.monad (close! [])))]
- (wrap to-worked?)))
- from-worked? from-worked?]
- (_.assert "Can communicate between client and server."
- (and from-worked?
- (error.default #0 result)))))
- ))))
diff --git a/stdlib/source/test/lux/world/net/udp.lux b/stdlib/source/test/lux/world/net/udp.lux
deleted file mode 100644
index 44765acab..000000000
--- a/stdlib/source/test/lux/world/net/udp.lux
+++ /dev/null
@@ -1,66 +0,0 @@
-(.module:
- [lux #*
- data/text/format
- ["r" math/random (#+ Random)]
- ["_" test (#+ Test)]
- ["." abstract/monad (#+ do)]
- [control
- ["." io]
- [concurrency
- ["." promise]]
- [security
- ["!" capability]]]
- [data
- ["." error]
- ["." text]]
- [world
- ["." binary]
- ["." net]]]
- {1
- ["." /]}
- [///
- ["_." binary]])
-
-(def: localhost net.Address "127.0.0.1")
-(def: port
- (r.Random net.Port)
- (|> r.nat
- (:: r.monad map
- (|>> (n/% 1000)
- (n/+ 8000)))))
-
-(def: #export test
- Test
- (<| (_.context (%name (name-of /._)))
- (do r.monad
- [port ..port
- size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 10))))
- from (_binary.binary size)
- to (_binary.binary size)]
- ($_ _.and
- (wrap (do promise.monad
- [result (promise.future
- (do (error.with io.monad)
- [server (/.server port)
- client /.client
- ####################
- _ (!.use (:: client write) [[localhost port] from])
- [bytes-from [from-address from-port] temp] (!.use (:: server read) size)
- #let [from-worked? (and (n/= size bytes-from)
- (:: binary.equivalence = from temp))]
- ####################
- _ (!.use (:: server write) [[from-address from-port] to])
- [bytes-to [to-address to-port] temp] (!.use (:: client read) size)
- #let [to-worked? (and (n/= size bytes-to)
- (:: binary.equivalence = to temp)
- (n/= port to-port))]
- ####################
- _ (!.use (:: client close) [])
- _ (!.use (:: server close) [])]
- ## (wrap false)
- (wrap (and from-worked?
- to-worked?))
- ))]
- (_.assert "Can communicate between client and server."
- (error.default #0 result))))
- ))))