humidity/test/humidity/saturation_vp_test.clj

36 lines
1.6 KiB
Clojure

(ns humidity.saturation-vp-test
(:require [clojure.test :refer [deftest is testing]]
[humidity.constants :refer [celsius-offset]]
[humidity.saturation-vapour-pressure :refer [saturation-vapour-pressure-fn]]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; 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 saturation-vp-test
(testing "from online sources"
(let [min-expected 5622
max-expected 5629
actual (saturation-vapour-pressure-fn {:temperature-celsius 35})]
(is (< min-expected actual max-expected)))
(let [min-expected 5622
max-expected 5629
actual (saturation-vapour-pressure-fn {:temperature-kelvin (+ celsius-offset 35)})]
(is (< min-expected actual max-expected)))))