aboutsummaryrefslogtreecommitdiff
path: root/licentia/source/test/licentia.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-06-14 18:33:54 -0400
committerEduardo Julian2021-06-14 18:33:54 -0400
commit519c0c0c71cdf7ce3dfc64b9781ab826760b3d94 (patch)
tree75fa0672afceff129e5e75afb7a5fed197ce1773 /licentia/source/test/licentia.lux
parentaf3e6e2cb011dc2ad9204440990731a2f272716d (diff)
Extracted Licentia out of the standard library.
Diffstat (limited to '')
-rw-r--r--licentia/source/test/licentia.lux (renamed from stdlib/source/test/licentia.lux)163
1 files changed, 81 insertions, 82 deletions
diff --git a/stdlib/source/test/licentia.lux b/licentia/source/test/licentia.lux
index af03062cb..bf0f4929e 100644
--- a/stdlib/source/test/licentia.lux
+++ b/licentia/source/test/licentia.lux
@@ -1,22 +1,21 @@
(.module:
[lux #*
+ [program (#+ program:)]
["_" test (#+ Test)]
[abstract
[monad (#+ do)]]
[control
- [io (#+ io)]
- [parser
- [cli (#+ program:)]]]
+ [io (#+ io)]]
[data
["." bit ("#\." equivalence)]
["." maybe ("#\." functor)]
["." text]
- [number
- ["n" nat ("#\." interval)]]
[collection
["." list ("#\." functor)]]]
[math
- ["." random (#+ Random)]]]
+ ["." random (#+ Random)]
+ [number
+ ["n" nat ("#\." interval)]]]]
{#program
[/
["." license (#+ Identification
@@ -25,7 +24,7 @@
Distribution
Commercial
Extension
- Entity Black-List
+ Entity Black_List
URL Attribution
Addendum
License)
@@ -41,7 +40,7 @@
["." commercial]
["." extension]
["." miscellaneous]
- ["." black-list]
+ ["." black_list]
["." addendum]]
["." output]]})
@@ -50,14 +49,14 @@
(do {! random.monad}
[start (random.filter (|>> (n.= n\top) not)
random.nat)
- #let [wiggle-room (n.- start n\top)]
+ #let [wiggle_room (n.- start n\top)]
end (\ ! map
- (|>> (n.% wiggle-room) (n.max 1))
+ (|>> (n.% wiggle_room) (n.max 1))
random.nat)]
(wrap {#time.start start
#time.end end})))
-(def: copyright-holder
+(def: copyright_holder
(Random copyright.Holder)
($_ random.and
(random.ascii 10)
@@ -107,18 +106,18 @@
(Random Entity)
(random.ascii 10))
-(def: (variable-list max-size gen-element)
+(def: (variable_list max_size gen_element)
(All [a] (-> Nat (Random a) (Random (List a))))
(do {! random.monad}
- [amount (\ ! map (n.% (n.max 1 max-size))
+ [amount (\ ! map (n.% (n.max 1 max_size))
random.nat)]
- (random.list amount gen-element)))
+ (random.list amount gen_element)))
-(def: black-list
- (Random Black-List)
+(def: black_list
+ (Random Black_List)
($_ random.and
(random.maybe (random.ascii 10))
- (variable-list 10 ..entity)))
+ (variable_list 10 ..entity)))
(def: url
(Random URL)
@@ -141,14 +140,14 @@
(def: license
(Random License)
($_ random.and
- (random.list 2 ..copyright-holder)
+ (random.list 2 ..copyright_holder)
(random.maybe ..identification)
..termination
..liability
..distribution
..commercial
..extension
- (variable-list 3 ..black-list)
+ (variable_list 3 ..black_list)
(random.maybe attribution)
..addendum
))
@@ -156,27 +155,27 @@
(type: (Concern a)
(-> (-> Text Bit) a Test))
-(def: (about-grant present? termination)
+(def: (about_grant present? termination)
(Concern Termination)
($_ _.and
(_.test "Copyright grant is present."
(present? grant.copyright))
(_.test "Patent grant is present."
- (present? (grant.patent (get@ #license.patent-retaliation? termination))))
+ (present? (grant.patent (get@ #license.patent_retaliation? termination))))
(_.test "Effective date for the grants is present."
(present? grant.date))
(_.test "Patent grant is present."
- (present? (grant.termination (get@ #license.termination-period termination)
- (get@ #license.grace-period termination))))
+ (present? (grant.termination (get@ #license.termination_period termination)
+ (get@ #license.grace_period termination))))
(_.test "The termination period is accurately conveyed."
- (present? (grant.grant-restoration-clause (get@ #license.termination-period termination))))
+ (present? (grant.grant_restoration_clause (get@ #license.termination_period termination))))
(_.test "The grace period is accurately conveyed."
- (present? (grant.grace-period-clause (get@ #license.grace-period termination))))
+ (present? (grant.grace_period_clause (get@ #license.grace_period termination))))
(_.test "The grants are not retro-actively terminated."
- (present? grant.no-retroactive-termination))
+ (present? grant.no_retroactive_termination))
))
-(def: (about-liability present? liability)
+(def: (about_liability present? liability)
(Concern Liability)
($_ _.and
(_.test "Warranty liability disclaimer is present."
@@ -186,65 +185,65 @@
(_.test "Litigation conditions are present."
(present? liability.litigation))
(_.test "Liability acceptance conditions may be present."
- (bit\= (get@ #license.can-accept? liability)
- (present? liability.can-accept)))
+ (bit\= (get@ #license.can_accept? liability)
+ (present? liability.can_accept)))
(_.test "Liability acceptance conditions may be present."
- (bit\= (get@ #license.disclaim-high-risk? liability)
- (present? liability.disclaim-high-risk)))
+ (bit\= (get@ #license.disclaim_high_risk? liability)
+ (present? liability.disclaim_high_risk)))
))
-(def: (about-distribution present? distribution)
+(def: (about_distribution present? distribution)
(Concern Distribution)
($_ _.and
(_.test "Conditions for source-code distribution are present."
- (present? distribution.source-code-form))
+ (present? distribution.source_code_form))
(_.test "Conditions for object-code distribution are present."
- (present? distribution.object-form))
+ (present? distribution.object_form))
(_.test "Conditions for extension distribution are present."
(present? (distribution.extension distribution)))
))
-(def: (about-commercial present? commercial)
+(def: (about_commercial present? commercial)
(Concern Commercial)
($_ _.and
(_.test "Non-commercial clause is present."
- (bit\= (not (get@ #license.can-sell? commercial))
- (present? commercial.cannot-sell)))
+ (bit\= (not (get@ #license.can_sell? commercial))
+ (present? commercial.cannot_sell)))
(_.test "Contributor credit condition is present."
- (bit\= (get@ #license.require-contributor-credit? commercial)
- (present? commercial.require-contributor-attribution)))
+ (bit\= (get@ #license.require_contributor_credit? commercial)
+ (present? commercial.require_contributor_attribution)))
(_.test "Anti-endorsement condition is present."
- (bit\= (not (get@ #license.allow-contributor-endorsement? commercial))
- (present? commercial.disallow-contributor-endorsement)))
+ (bit\= (not (get@ #license.allow_contributor_endorsement? commercial))
+ (present? commercial.disallow_contributor_endorsement)))
))
-(def: (about-extension present? extension)
+(def: (about_extension present? extension)
(Concern Extension)
($_ _.and
(_.test "The license is viral."
- (bit\= (get@ #license.same-license? extension)
- (and (list.every? present? extension.sharing-requirement)
- (list.every? present? extension.license-conflict-resolution))))
+ (bit\= (get@ #license.same_license? extension)
+ (and (list.every? present? extension.sharing_requirement)
+ (list.every? present? extension.license_conflict_resolution))))
(_.test "Extensions must be distinguishable from the original work."
- (bit\= (get@ #license.must-be-distinguishable? extension)
- (present? extension.distinctness-requirement)))
+ (bit\= (get@ #license.must_be_distinguishable? extension)
+ (present? extension.distinctness_requirement)))
(_.test "The community must be notified of new extensions."
- (case (get@ #license.notification-period extension)
+ (case (get@ #license.notification_period extension)
(#.Some period)
- (present? (extension.notification-requirement period))
+ (present? (extension.notification_requirement period))
#.None
true))
(_.test "Must describe modifications."
- (bit\= (get@ #license.must-describe-modifications? extension)
- (present? extension.description-requirement)))
+ (bit\= (get@ #license.must_describe_modifications? extension)
+ (present? extension.description_requirement)))
))
-(def: (about-attribution present? attribution)
+(def: (about_attribution present? attribution)
(Concern Attribution)
($_ _.and
(_.test "The attribution copyright notice is present."
- (present? (get@ #license.copyright-notice attribution)))
+ (present? (get@ #license.copyright_notice attribution)))
(_.test "The attribution phrase is present."
(|> attribution
(get@ #license.phrase)
@@ -259,29 +258,29 @@
(maybe.default true)))
))
-(def: (about-miscellaneous present?)
+(def: (about_miscellaneous present?)
(-> (-> Text Bit) Test)
($_ _.and
(_.test "License constitutes the entire agreement."
- (present? miscellaneous.entire-agreement))
+ (present? miscellaneous.entire_agreement))
(_.test "Disclaims relationship of parties."
- (present? miscellaneous.relationship-of-parties))
+ (present? miscellaneous.relationship_of_parties))
(_.test "Explicitly allows independent development."
- (present? miscellaneous.independent-development))
+ (present? miscellaneous.independent_development))
(_.test "Clarifies consent to breach does not waiver."
- (present? miscellaneous.not-waiver))
+ (present? miscellaneous.not_waiver))
(_.test "Provides severability."
(present? miscellaneous.severability))
(_.test "Covers export restrictions."
- (present? miscellaneous.export-restrictions))
+ (present? miscellaneous.export_restrictions))
))
-(def: (about-addendum present? value)
+(def: (about_addendum present? value)
(Concern Addendum)
($_ _.and
(_.test "Commons clause"
- (bit\= (get@ #license.commons-clause? value)
- (present? addendum.commons-clause)))
+ (bit\= (get@ #license.commons_clause? value)
+ (present? addendum.commons_clause)))
))
(def: test
@@ -294,33 +293,33 @@
(text.contains? snippet writ)))]]
($_ _.and
(_.test "Copyright notices are present."
- (list.every? (|>> notice.copyright-holder present?)
- (get@ #license.copyright-holders license)))
+ (list.every? (|>> notice.copyright_holder present?)
+ (get@ #license.copyright_holders license)))
(_.test "Identification is present (if the license is identified)."
(case (get@ #license.identification license)
(#.Some identification)
(and (present? (output.identification identification))
- (present? miscellaneous.new-versions))
+ (present? miscellaneous.new_versions))
#.None
- (not (present? miscellaneous.new-versions))))
+ (not (present? miscellaneous.new_versions))))
(_.test "Black-lists (if wanted by licensor) are explicitly enumerated and justified."
- (list.every? (function (_ black-list)
- (let [black-list-is-justified? (case (get@ #license.justification black-list)
+ (list.every? (function (_ black_list)
+ (let [black_list_is_justified? (case (get@ #license.justification black_list)
(#.Some justification)
(present? justification)
#.None
yes)
- every-entity-is-mentioned? (|> black-list
+ every_entity_is_mentioned? (|> black_list
(get@ #license.entities)
- (list\map black-list.entity)
+ (list\map black_list.entity)
(list.every? present?))]
- (and black-list-is-justified?
- every-entity-is-mentioned?)))
- (get@ #license.black-lists license)))
+ (and black_list_is_justified?
+ every_entity_is_mentioned?)))
+ (get@ #license.black_lists license)))
(_.test "All definitions are present."
(list.every? (|>> output.definition present?)
@@ -329,7 +328,7 @@
(_.test "Acceptance of the license is demanded."
(present? limitation.acceptance))
- (..about-grant present? (get@ #license.termination license))
+ (..about_grant present? (get@ #license.termination license))
(_.test "All limitations are present."
(present? output.limitation))
@@ -340,28 +339,28 @@
(_.test "The terms of submission are present."
(present? submission.contribution))
- (..about-liability present? (get@ #license.liability license))
+ (..about_liability present? (get@ #license.liability license))
- (..about-distribution present? (get@ #license.distribution license))
+ (..about_distribution present? (get@ #license.distribution license))
- (..about-commercial present? (get@ #license.commercial license))
+ (..about_commercial present? (get@ #license.commercial license))
- (..about-extension present? (get@ #license.extension license))
+ (..about_extension present? (get@ #license.extension license))
(case (get@ #license.attribution license)
(#.Some attribution)
- (..about-attribution present? attribution)
+ (..about_attribution present? attribution)
#.None
(_.test "Attribution is missing."
yes))
- (..about-miscellaneous present?)
+ (..about_miscellaneous present?)
- (..about-addendum present? (get@ #license.addendum license))
+ (..about_addendum present? (get@ #license.addendum license))
(_.test "License ending footer is present."
- (present? notice.end-of-license))
+ (present? notice.end_of_license))
)))
(program: args