From fcee38da766a683ed5569978be153c6e7a8ae0af Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 20 Jun 2019 19:49:34 -0400 Subject: Removed the TCP & UDP code for the moment. It needs to be re-designed with a multi-platform focus in mind. --- stdlib/source/test/lux/world.lux | 5 --- stdlib/source/test/lux/world/net/tcp.lux | 73 -------------------------------- stdlib/source/test/lux/world/net/udp.lux | 66 ----------------------------- 3 files changed, 144 deletions(-) delete mode 100644 stdlib/source/test/lux/world/net/tcp.lux delete mode 100644 stdlib/source/test/lux/world/net/udp.lux (limited to 'stdlib/source/test') 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)))) - )))) -- cgit v1.2.3