Renaming circlebot -> advisorycircular.
This commit is contained in:
parent
de7c72b2f6
commit
dd92df15f9
@ -11,8 +11,8 @@
|
||||
:builds
|
||||
{:script
|
||||
{:target :node-script
|
||||
:main lemondronor.circlebot/main
|
||||
:output-to "out/script.js"}
|
||||
:main lemondronor.advisorycircular/main
|
||||
:output-to "out/advisorycircular.js"}
|
||||
:test
|
||||
{:target :node-test
|
||||
:output-to "out/node-tests.js"
|
||||
|
@ -1,6 +1,6 @@
|
||||
(ns lemondronor.circlebot.generation-test
|
||||
(ns lemondronor.advisorycircular.generation-test
|
||||
(:require [cljs.test :refer (deftest is testing)]
|
||||
[lemondronor.circlebot.generation :as generation]))
|
||||
[lemondronor.advisorycircular.generation :as generation]))
|
||||
|
||||
(deftest parse-template
|
||||
(is (= [:optional [:varref "woo"]]
|
@ -1,6 +1,6 @@
|
||||
(ns lemondronor.circlebot.util-test
|
||||
(ns lemondronor.advisorycircular.util-test
|
||||
(:require [cljs.test :refer (deftest is testing)]
|
||||
[lemondronor.circlebot.util :as util]))
|
||||
[lemondronor.advisorycircular.util :as util]))
|
||||
|
||||
(deftest deep-merge
|
||||
(is (= (util/deep-merge
|
@ -1,6 +1,6 @@
|
||||
(ns lemondronor.circlebot-test
|
||||
(ns lemondronor.advisorycircular-test
|
||||
(:require [cljs.test :refer (deftest is testing)]
|
||||
[lemondronor.circlebot :as circlebot]))
|
||||
[lemondronor.advisorycircular :as advisorycircular]))
|
||||
|
||||
|
||||
(def epsilon 0.0000010)
|
||||
@ -27,7 +27,7 @@
|
||||
"opicao" "AAR", "interested" "0", "trak" "264.4", "type" "A388",
|
||||
"trkh" "0", "icao" "71BE34", "lat" "33.937908", "vsit" "1",
|
||||
"tisb" "0", "vsi" "0", "sat" "0"}]
|
||||
(is (= (circlebot/parse-adsbexchange-ac-element ac)
|
||||
(is (= (advisorycircular/parse-adsbexchange-ac-element ac)
|
||||
{:icao "71BE34"
|
||||
:registration "HL7634"
|
||||
:callsign nil
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
(deftest prune-history
|
||||
(let [hist [{:time 0 :id 0} {:time 1000000 :id 1} {:time 2000000 :id 2}]]
|
||||
(is (= (circlebot/prune-history hist 2500000 circlebot/default-config)
|
||||
(is (= (advisorycircular/prune-history hist 2500000 advisorycircular/default-config)
|
||||
[{:time 2000000 :id 2}]))))
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
:lat 1
|
||||
:lon 1
|
||||
:postime 3500}]
|
||||
(is (= (circlebot/update-history-db-record db record)
|
||||
(is (= (advisorycircular/update-history-db-record db record)
|
||||
{"0" {:icao "0"
|
||||
:lat 1
|
||||
:lon 1
|
||||
@ -85,7 +85,7 @@
|
||||
:lat 1
|
||||
:lon 1
|
||||
:postime 3500}]
|
||||
(is (= (circlebot/update-history-db-record db record)
|
||||
(is (= (advisorycircular/update-history-db-record db record)
|
||||
{"0" {:icao "0"
|
||||
:lat 0
|
||||
:lon 0
|
||||
@ -103,24 +103,24 @@
|
||||
|
||||
(deftest expand-template
|
||||
(let [data {:locality "Palmdale", :continent "North America", :military? true, :alt 3850, :speed "209", :normalized-curviness 14.768651250300287, :accuracy "centroid", :country_a "USA", :continent_gid "whosonfirst:continent:102191575", :name "Palmdale", :squawk "5330", :icao "AE1482", :county_a "LO", :county "Los Angeles County", :source "whosonfirst", :gid "whosonfirst:locality:85923493", :curviness 1269.8089810739468, :locality_gid "whosonfirst:locality:85923493", :region "California", :militaryicao "AE1482", :region_a "CA", :nearbydistance 8.167, :callsign "RAIDR49", :layer "locality", :mlat? false, :country_gid "whosonfirst:country:85633793", :label "Palmdale, CA, USA", :id "85923493", :lon -118.00375, :region_gid "whosonfirst:region:85688637", :lat 34.661074, :militaryregistration "166765", :county_gid "whosonfirst:county:102086957", :started-circling-time 1576266715691, :distance 6.855, :source_id "85923493", :registration "166765", :confidence 0.5, :country "United States", :postime 1576266689756, :nearbylandmark "Living Faith Foursquare Church"}]
|
||||
(is (strmatch #"military" (-> (circlebot/expand-template data) :text))))
|
||||
(is (strmatch #"military" (-> (advisorycircular/expand-template data) :text))))
|
||||
(let [data {:locality "Palmdale", :continent "North America", :military? true, :alt 3200, :speed "161", :normalized-curviness 15.783422690487765, :accuracy "centroid", :country_a "USA", :continent_gid "whosonfirst:continent:102191575", :name "Palmdale", :squawk "5330", :icao "AE1482", :county_a "LO", :county "Los Angeles County", :source "whosonfirst", :gid "whosonfirst:locality:85923493", :curviness 1098.803548060181, :locality_gid "whosonfirst:locality:85923493", :region "California", :militaryicao "AE1482", :region_a "CA", :nearbydistance 7.828, :callsign "RAIDR49", :layer "locality", :mlat? false, :country_gid "whosonfirst:country:85633793", :label "Palmdale, CA, USA", :id "85923493", :lon -118.049183, :region_gid "whosonfirst:region:85688637", :lat 34.649808, :militaryregistration "166765", :county_gid "whosonfirst:county:102086957", :started-circling-time 1576267564959, :distance 6.336, :source_id "85923493", :registration "166765", :confidence 0.5, :country "United States", :postime 1576267555709, :nearbylandmark "Living Faith Foursquare Church"}]
|
||||
(is (strmatch #"military" (-> (circlebot/expand-template data) :text))))
|
||||
(is (strmatch #"military" (-> (advisorycircular/expand-template data) :text))))
|
||||
(testing "a vs. an for type"
|
||||
(let [data {:registration "TEST" :icao "123" :type "Airbus 380" :locality "Test City"}]
|
||||
(is (strmatch #"an Airbus" (:text (circlebot/expand-template data)))))
|
||||
(is (strmatch #"an Airbus" (:text (advisorycircular/expand-template data)))))
|
||||
(let [data {:registration "TEST" :icao "123" :type "Yoyo 380" :locality "Test City"}]
|
||||
(is (strmatch #"a Yoyo" (:text (circlebot/expand-template data)))))))
|
||||
(is (strmatch #"a Yoyo" (:text (advisorycircular/expand-template data)))))))
|
||||
|
||||
|
||||
(deftest merge-adsbx-sqb
|
||||
(is (= (circlebot/merge-adsbx-sqb {:registration "N1"}
|
||||
(is (= (advisorycircular/merge-adsbx-sqb {:registration "N1"}
|
||||
{:registration "N2" :type "B52"})
|
||||
{:registration "N1", :type "B52"}))
|
||||
(is (= (circlebot/merge-adsbx-sqb {:registration nil}
|
||||
(is (= (advisorycircular/merge-adsbx-sqb {:registration nil}
|
||||
{:registration "N2" :type "B52"})
|
||||
{:registration "N2", :type "B52"}))
|
||||
(is (= (circlebot/merge-adsbx-sqb {:registration "N1"}
|
||||
(is (= (advisorycircular/merge-adsbx-sqb {:registration "N1"}
|
||||
{:registration "N2" :type nil})
|
||||
{:registration "N1", :type nil})))
|
||||
|
||||
@ -133,7 +133,7 @@
|
||||
:type "B52"}
|
||||
reverse {:properties {:neighbourhood "Silver Lake" :locality "Los Angeles"}}
|
||||
nearby nil
|
||||
desc (circlebot/generate-description ac sqb reverse nearby)]
|
||||
desc (advisorycircular/generate-description ac sqb reverse nearby)]
|
||||
(is (strmatch #"NBADB0Y" desc))
|
||||
(is (strmatch #"a B52" desc))
|
||||
(is (strmatch #"Silver Lake.*Los Angeles" desc))
|
||||
@ -144,7 +144,7 @@
|
||||
:type "B52"}
|
||||
reverse {:properties {:neighbourhood "Silver Lake" :locality "Los Angeles"}}
|
||||
nearby {:name "Disneyland" :distance 2}
|
||||
desc (circlebot/generate-description ac sqb reverse nearby)]
|
||||
desc (advisorycircular/generate-description ac sqb reverse nearby)]
|
||||
(is (strmatch #"NGOODB0Y" desc))
|
||||
(is (strmatch #"a B52" desc))
|
||||
(is (strmatch #"Silver Lake.*Los Angeles" desc))
|
||||
@ -155,7 +155,7 @@
|
||||
sqb {:registration "N80NT", :type "Eurocopter Squirrel AS 350 B2"}
|
||||
reverse {:properties {:neighbourhood "Silver Lake" :locality "Los Angeles"}}
|
||||
nearby {:name "Disneyland" :distance 2}
|
||||
desc (circlebot/generate-description ac sqb reverse nearby)]
|
||||
desc (advisorycircular/generate-description ac sqb reverse nearby)]
|
||||
(is (strmatch #"N80NT" desc))
|
||||
(is (strmatch #"a Eurocopter Squirrel AS 350 B2" desc))
|
||||
(is (strmatch #"callsign N80NT" desc))
|
||||
@ -171,10 +171,10 @@
|
||||
(let [landmarks [{:properties {:name "Johnny Depp"}}
|
||||
{:properties {:name "Musso & Frank's"}}
|
||||
{:properties {:name "Johnny Depp's Star"}}]]
|
||||
(is (= (circlebot/filter-landmarks {:blocklist ["Johnny Depp"]}
|
||||
(is (= (advisorycircular/filter-landmarks {:blocklist ["Johnny Depp"]}
|
||||
landmarks)
|
||||
[{:properties {:name "Musso & Frank's"}}]))
|
||||
(is (= (circlebot/filter-landmarks {:blocklist ["Frank"]}
|
||||
(is (= (advisorycircular/filter-landmarks {:blocklist ["Frank"]}
|
||||
landmarks)
|
||||
[{:properties {:name "Johnny Depp"}}
|
||||
{:properties {:name "Johnny Depp's Star"}}])))))
|
Loading…
Reference in New Issue
Block a user