14 Commits

Author SHA1 Message Date
Celtic Minstrel
d910171b3d Rewrite the help markup parser.
It is now roughly a superset of Pango and supports the following new features
* XML character entities, including decimal and hex entities, common named entities (apos, quot, lt, gt, amp), and even unrecognized named entities
* Nesting tags within each other (new-style only)
* Attributes without a value
2024-09-23 19:49:44 -04:00
Rafael Fillipe Silva
c7e643bffd add a test to cover the fix to find_key's infinite loop/crash
Adds a test with a schema example containing a super cycle and a .cfg file containing an unknown key to this schema. Previously, this would cause an infinite loop or crash. Now an exception for invalid key should be thrown.
2024-02-26 10:12:43 -06:00
Rafael Fillipe Silva
fd6cd7c2a2 add tests for super cycle detection on schema self validator
Add test for the already existing validation where a tag shouldn't set itself as its own super.

Add test for the new cycle detection when validating a schema.
2024-02-26 10:12:43 -06:00
Eugene
9f99a4ef7d
Simplify nearest neighbor rescale (#8240) 2024-01-20 16:50:14 -06:00
Steve Cotton
cc8dddea6e Support negative numbers in ranges
Adds support for using these in the weapons and ability filters:
* "-1", which was previously treated as an parse error (no number before the separator).
* "-3--1"
* "-infinity" as the lower number in the range, provided a different upper number is given.

This treats "-infinity" (with no other number), "-infinity--infinity",
"infinity" (with no other number) and "infinity-infinity" as errors. It seems
unlikely that someone would intend to use a filter that can't match any
reasonable number.

The range "-infinity-infinity" will be parsed successfully. I don't see a use
case for that, but nor do I see a reason to add extra C++ to reject it.
However, it's not added to the schema, as I think it's good for the schema to
give a warning when someone creates a filter which will accept every value
(including accepting the default, so "-infinity-infinity" accepts the unset
value too).

Includes new unit tests for the C++ and the Lua stringx.parse_range functions.
The next commit adds more WML tests, but is kept separate to credit the author.

This started as a change to move common filter functions from unit.cpp to
somewhere that they could be reused for other config-based filters. In the
process a missing feature was found and added, the move is still included in a
single Git commit because the move was required in order to make these
functions accessible to the Boost unit tests.

Two CodeBlocks project files additionally get src/utils/any.hpp added,
which was in one of them but missing from the other two. I noticed because
these are alphabetically at the start of the src/utils file list.

Thanks to @CelticMinstrel for the review comments and Xcode project updates.
2023-08-11 21:59:06 +02:00
Pentarctagon
b586e38e30 Move simple_wml unit test into the actual unit tests. 2022-07-30 00:07:46 -05:00
Pentarctagon
c4c292fa3b Replace all remaining usages if MAKE_ENUM. 2022-03-03 21:23:02 -06:00
CrawlCycle
a6f36becb9 Test parsing of WML define and undef macros by the preprocessor & parser
This commit adds tools to test parsing of WML macros by the preprocessor
and parser. The commit also adds two tests of the #define and #undef
WML macro as examples.

The tests consist of three steps:

1. Define one WML string containing macros and one WML string
   that lacks macros in each test. The two WML strings should be
   equivalent after preprocessing.

2. Transform each WML string into a syntax tree (represented by config
   objects) with the preprocessor and parser of Wesnoth.

3. Check if the two config objects are equal. Since the two WML strings
   are equivalent, the two configs object should be equivalent if the
   preprocessor and parsers are both correct.

The output of the preprocessor is in an undocumented format. Therefore,
this commit does not test the preprocessor as an isolated unit.
2020-11-28 14:52:48 -05:00
Iris Morelle
37cca84684 Add utils::format_timespan() for formatting time lengths for user display 2019-03-01 02:29:20 -03:00
Martin Hrubý
96bbebb514 Fix building with Xcode 10 (#3460)
Resolves #3458.

(cherry-picked from commit 50301f84e33d828c39835bc47f04dd1107631960)
2018-10-07 03:24:17 +00:00
Pentarctagon
d6833d76d0 Remove unused test file and images.
(cherry-picked from commit 0a7ed44c087f1c66d65b8656fc197309d4c0325a)
2018-10-07 03:22:49 +00:00
Charles Dang
34e065e011 Tests: removed another empty file I missed in c93aebb1debc
Its contents were also removed when SDL 1.2 was dropped.
2017-11-27 09:47:45 +11:00
Charles Dang
c93aebb1de Tests: removed empty files
These were emptied out when SDL 1.2 was removed (358bd1235f07d8d577). I seem to recall
someone saying it might be worth keeping them around in case something needed to be put
back, but it's been a year and a half. Not much worth in keeping empty files.
2017-11-27 09:42:14 +11:00
Gregory A Lundberg
d091391899 Renamed the target and binary for the Boost unit tests from test to boost_unit_tests
This quells warnings from CMake about reserved target names, and reduces confusion about which `test` is intended: the wesnoth executable or the standard shell command.
2017-11-06 20:32:27 +02:00