humidity/test/humidity/core_test.clj

41 lines
1.7 KiB
Clojure

(ns humidity.core-test
(:require
[clojure.test :refer [deftest is testing]]
[humidity.core :refer [resolution]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (C) 2026 Simon Brooke
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License
;;; as published by the Free Software Foundation; either version 2
;;; of the License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;; USA.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftest resolution-test
(testing "resolution")
(let [expected {:absolute-humidity 3953.618101887827,
:pressure-pascals 101325,
:temperature-celsius 35,
:dew-point-celsius 35.00000000000001,
:pressure-millibars 1013.25,
:volume 1.1281347245103424,
:temperature-kelvin 308.15,
:relative-humidity 100,
:saturation-vapour-pressure 5622.488734516426,
:actual-vapour-pressure 4765.10094206357}
packet {:relative-humidity 100 :temperature-celsius 35}
actual (resolution packet)]
(is (= actual expected))))