From ae2d5697d93a45dcbff768c32c4dc8fb291096cd Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 7 Jan 2023 18:55:20 -0400 Subject: Now wrapping C++ values inside a universal box. --- stdlib/source/test/aedifex/repository.lux | 64 ++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 14 deletions(-) (limited to 'stdlib/source/test/aedifex/repository.lux') diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index f61f1ec50..6b4f02130 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -7,11 +7,14 @@ ["[0]" monad (.only do)]] [control ["[0]" io] - ["[0]" try] - ["[0]" exception (.only Exception)]] + ["[0]" try (.only Try)] + ["[0]" exception (.only Exception)] + [concurrency + ["[0]" async (.only Async)]]] [data ["[0]" product] - ["[0]" binary (.only Binary)] + ["[0]" binary (.only Binary) + ["_[1]" \\test]] ["[0]" text (.only) ["%" \\format (.only format)]] [collection @@ -22,7 +25,8 @@ [net ["[0]" uri (.only URI)]]] [test - ["_" property (.only Test)]]]] + ["_" property (.only Test)] + ["[0]" unit]]]] ["[0]" / ["[1][0]" identity] ["[1][0]" origin] @@ -30,8 +34,6 @@ ["[1][0]" remote] [// ["@[0]" artifact]]] - [\\specification - ["$[0]" /]] [\\program ["[0]" / (.only) ["[0]" remote] @@ -39,6 +41,40 @@ ["[1][0]" artifact (.only Version Artifact) ["[1]/[0]" extension (.only Extension)]]]]]) +(def .public (spec valid_artifact invalid_artifact subject) + (-> Artifact Artifact (/.Repository Async) + Test) + (do random.monad + [expected (_binary.random 100)] + (in (all unit.and + (do async.monad + [.let [good_uri (remote.uri (the //artifact.#version valid_artifact) valid_artifact //artifact/extension.lux_library)] + good_upload! (of subject upload good_uri expected) + good_download! (of subject download good_uri) + + .let [bad_uri (remote.uri (the //artifact.#version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] + bad_upload! (of subject upload bad_uri expected) + bad_download! (of subject download bad_uri)] + (unit.coverage [/.Repository] + (let [successfull_flow! + (when [good_upload! good_download!] + [{try.#Success _} {try.#Success actual}] + (of binary.equivalence = expected actual) + + _ + false) + + failed_flow! + (when [bad_upload! bad_download!] + [{try.#Failure _} {try.#Failure _}] + true + + _ + false)] + (and successfull_flow! + failed_flow!)))) + )))) + (def artifact (-> Version Artifact) (|>> ["com.github.luxlang" "test-artifact"])) @@ -94,14 +130,14 @@ (_.for [/.mock /.Mock] (do random.monad [_ (in [])] - ($/.spec (..artifact ..valid_version) - (..artifact ..invalid_version) - (/.mock ..mock - (|> ..empty - (dictionary.has (remote.uri ..invalid_version - (..artifact ..invalid_version) - //artifact/extension.lux_library) - (binary.empty 0))))))) + (..spec (..artifact ..valid_version) + (..artifact ..invalid_version) + (/.mock ..mock + (|> ..empty + (dictionary.has (remote.uri ..invalid_version + (..artifact ..invalid_version) + //artifact/extension.lux_library) + (binary.empty 0))))))) /identity.test /origin.test -- cgit v1.2.3