30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'ops'))
|
|
from minimap_water125 import true_water_loss
|
|
|
|
|
|
class TrueWaterLossTest(unittest.TestCase):
|
|
def test_dark_teal_is_existing_water(self):
|
|
source = np.full((512, 512, 3), (75, 160, 190), dtype=np.uint8)
|
|
live = np.full((512, 512, 3), (40, 80, 65), dtype=np.uint8)
|
|
self.assertEqual(true_water_loss(source, live), 0)
|
|
|
|
def test_dry_land_is_missing_water(self):
|
|
source = np.full((512, 512, 3), (75, 160, 190), dtype=np.uint8)
|
|
live = np.full((512, 512, 3), (120, 100, 60), dtype=np.uint8)
|
|
self.assertEqual(true_water_loss(source, live), 512 * 512)
|
|
|
|
def test_pale_snow_is_not_source_water(self):
|
|
source = np.full((512, 512, 3), (240, 245, 250), dtype=np.uint8)
|
|
live = np.full((512, 512, 3), (240, 240, 240), dtype=np.uint8)
|
|
self.assertEqual(true_water_loss(source, live), 0)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|