| 1 | /* Copyright (c) 2018, 2026, Oracle and/or its affiliates. |
| 2 | This program is free software; you can redistribute it and/or modify |
| 3 | it under the terms of the GNU General Public License, version 2.0, |
| 4 | as published by the Free Software Foundation. |
| 5 | |
| 6 | This program is designed to work with certain software (including |
| 7 | but not limited to OpenSSL) that is licensed under separate terms, |
| 8 | as designated in a particular file or component or in included license |
| 9 | documentation. The authors of MySQL hereby grant you an additional |
| 10 | permission to link the program and your derivative works with the |
| 11 | separately licensed software that they have either included with |
| 12 | the program or referenced in the documentation. |
| 13 | |
| 14 | This program is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU General Public License, version 2.0, for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
| 20 | along with this program; if not, write to the Free Software |
| 21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
| 22 | |
| 23 | #include <gtest/gtest.h> |
| 24 | |
| 25 | #include "sql/gis/area.h" |
| 26 | |
| 27 | #include "unittest/gunit/gis_test.h" |
| 28 | #include "unittest/gunit/gis_typeset.h" |
| 29 | |
| 30 | namespace { |
| 31 | |
| 32 | template <typename T_typeset> |
| 33 | struct Area : Gis_test<T_typeset> {}; |
| 34 | |
| 35 | TYPED_TEST_SUITE(Area, gis_typeset::Test_both); |
| 36 | |
| 37 | TYPED_TEST(Area, empty_polygon) { |
| 38 | typename TypeParam::Polygon g{}; |
| 39 | double result; |
| 40 | bool result_null; |
| 41 | gis::area(this->m_srs.get(), &g, "testcase", &result, &result_null); |
| 42 | EXPECT_TRUE(result_null); |
| 43 | } |
| 44 | |
| 45 | TYPED_TEST(Area, empty_multipolygon) { |
| 46 | typename TypeParam::Multipolygon g{}; |
| 47 | double result; |
| 48 | bool result_null; |
| 49 | gis::area(this->m_srs.get(), &g, "testcase", &result, &result_null); |
| 50 | EXPECT_TRUE(result_null); |
| 51 | } |
| 52 | |
| 53 | } // namespace |