From: Carl Hetherington Date: Tue, 17 Jan 2023 16:20:57 +0000 (+0100) Subject: Add some very basic tests of Collator. X-Git-Tag: v2.16.41~21 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=6e09a576c0f1e36d442c40e1d3ddb6c29df8b7ea Add some very basic tests of Collator. --- diff --git a/test/collator_test.cc b/test/collator_test.cc new file mode 100644 index 000000000..fadc5f063 --- /dev/null +++ b/test/collator_test.cc @@ -0,0 +1,32 @@ +/* + Copyright (C) 2023 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic 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. + + DCP-o-matic 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 DCP-o-matic. If not, see . + +*/ + + +#include "lib/collator.h" +#include + + +BOOST_AUTO_TEST_CASE(collator_compare_works_and_ignores_case) +{ + Collator collator; + + BOOST_CHECK_EQUAL(collator.compare("So often YOU won't even notice", "SO OFTEN you won't even NOTiCE"), 0); + BOOST_CHECK_EQUAL(collator.compare("So often YOU won't even notice", "SO OFTEN you won't even see"), -1); +} diff --git a/test/wscript b/test/wscript index e54d5c985..5807d94ea 100644 --- a/test/wscript +++ b/test/wscript @@ -60,6 +60,7 @@ def build(bld): cinema_sound_processor_test.cc client_server_test.cc closed_caption_test.cc + collator_test.cc colour_conversion_test.cc config_test.cc content_test.cc