OpenTTD Source: src/tests/string_func.cpp File Reference

OpenTTD Source 15.0-beta1

Functions | Variables
string_func.cpp File Reference

Test functionality from string_func. More...

`#include "../stdafx.h"`
`#include "../3rdparty/catch2/catch.hpp"`
`#include "../string_func.h"`

Go to the source code of this file.

## Functions
| TEST_CASE ("StrCompareIgnoreCase - std::string")
| TEST_CASE ("StrCompareIgnoreCase - char pointer")
| TEST_CASE ("StrCompareIgnoreCase - std::string_view")
| TEST_CASE ("StrEqualsIgnoreCase - std::string")
| TEST_CASE ("StrEqualsIgnoreCase - char pointer")
| TEST_CASE ("StrEqualsIgnoreCase - std::string_view")
| TEST_CASE ("StrStartsWithIgnoreCase - std::string")
| TEST_CASE ("StrStartsWithIgnoreCase - char pointer")
| TEST_CASE ("StrStartsWithIgnoreCase - std::string_view")
| TEST_CASE ("StrEndsWithIgnoreCase - std::string")
| TEST_CASE ("StrEndsWithIgnoreCase - char pointer")
| TEST_CASE ("StrEndsWithIgnoreCase - std::string_view")
| TEST_CASE ("FormatArrayAsHex")
| TEST_CASE ("ConvertHexToBytes")
| TEST_CASE ("StrTrimInPlace")
| TEST_CASE ("StrTrimView")

## Variables
static const std::vector< std::pair< std::string, std::string > > | _str_trim_testcases

## Detailed Description

Test functionality from string_func.

Definition in file string_func.cpp.

## Function Documentation

## ◆ TEST_CASE() [1/16]

TEST_CASE | ( | "ConvertHexToBytes" |  | ) |

Definition at line 346 of file string_func.cpp.

## ◆ TEST_CASE() [2/16]

TEST_CASE | ( | "FormatArrayAsHex" |  | ) |

Definition at line 339 of file string_func.cpp.

## ◆ TEST_CASE() [3/16]

TEST_CASE | ( | "StrCompareIgnoreCase - char pointer" |  | ) |

Definition at line 42 of file string_func.cpp.

## ◆ TEST_CASE() [4/16]

TEST_CASE | ( | "StrCompareIgnoreCase - std::string" |  | ) |

Definition at line 18 of file string_func.cpp.

## ◆ TEST_CASE() [5/16]

TEST_CASE | ( | "StrCompareIgnoreCase - std::string_view" |  | ) |

Definition at line 66 of file string_func.cpp.

## ◆ TEST_CASE() [6/16]

TEST_CASE | ( | "StrEndsWithIgnoreCase - char pointer" |  | ) |

Definition at line 278 of file string_func.cpp.

## ◆ TEST_CASE() [7/16]

TEST_CASE | ( | "StrEndsWithIgnoreCase - std::string" |  | ) |

Definition at line 253 of file string_func.cpp.

## ◆ TEST_CASE() [8/16]

TEST_CASE | ( | "StrEndsWithIgnoreCase - std::string_view" |  | ) |

Definition at line 303 of file string_func.cpp.

## ◆ TEST_CASE() [9/16]

TEST_CASE | ( | "StrEqualsIgnoreCase - char pointer" |  | ) |

Definition at line 118 of file string_func.cpp.

## ◆ TEST_CASE() [10/16]

TEST_CASE | ( | "StrEqualsIgnoreCase - std::string" |  | ) |

Definition at line 100 of file string_func.cpp.

## ◆ TEST_CASE() [11/16]

TEST_CASE | ( | "StrEqualsIgnoreCase - std::string_view" |  | ) |

Definition at line 136 of file string_func.cpp.

## ◆ TEST_CASE() [12/16]

TEST_CASE | ( | "StrStartsWithIgnoreCase - char pointer" |  | ) |

Definition at line 191 of file string_func.cpp.

## ◆ TEST_CASE() [13/16]

TEST_CASE | ( | "StrStartsWithIgnoreCase - std::string" |  | ) |

Definition at line 166 of file string_func.cpp.

## ◆ TEST_CASE() [14/16]

TEST_CASE | ( | "StrStartsWithIgnoreCase - std::string_view" |  | ) |

Definition at line 216 of file string_func.cpp.

## ◆ TEST_CASE() [15/16]

TEST_CASE | ( | "StrTrimInPlace" |  | ) |

Definition at line 397 of file string_func.cpp.

## ◆ TEST_CASE() [16/16]

TEST_CASE | ( | "StrTrimView" |  | ) |

Definition at line 405 of file string_func.cpp.

## Variable Documentation

## ◆ _str_trim_testcases

const std::vector<std::pair<std::string, std::string> > _str_trim_testcases
| static

Initial value:
= {
{"a", "a"},
{" a", "a"},
{"a ", "a"},
{" a ", "a"},
{" a b c ", "a b c"},
{" ", ""}
}

Definition at line 388 of file string_func.cpp.