mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-13 04:00:16 +00:00
antiprompts
: avoid c++20 struct initializers in test
This commit is contained in:
parent
0fc5ad7ae1
commit
d9451fd647
@ -33,53 +33,53 @@ int main()
|
|||||||
antiprompts.build(tokenizer, {"abc", "bcd"}, {"bca", "x"});
|
antiprompts.build(tokenizer, {"abc", "bcd"}, {"bca", "x"});
|
||||||
|
|
||||||
assert_equal(antiprompts.findSingleTokenMatch('x'), {
|
assert_equal(antiprompts.findSingleTokenMatch('x'), {
|
||||||
.pos = 0,
|
/* .pos = */ 0,
|
||||||
.pattern = "x",
|
/* .pattern = */ "x",
|
||||||
.is_partial = false,
|
/* .is_partial = */ false,
|
||||||
.matchLength = 1,
|
/* .matchLength = */ 1,
|
||||||
.is_grammar_trigger = true,
|
/* .is_grammar_trigger = */ true,
|
||||||
});
|
});
|
||||||
assert_equal(antiprompts.findSingleTokenMatch('a'), {
|
assert_equal(antiprompts.findSingleTokenMatch('a'), {
|
||||||
.pos = std::string::npos,
|
/* .pos = */ std::string::npos,
|
||||||
.pattern = "",
|
/* .pattern = */ "",
|
||||||
.is_partial = false,
|
/* .is_partial = */ false,
|
||||||
.matchLength = 0,
|
/* .matchLength = */ 0,
|
||||||
.is_grammar_trigger = false,
|
/* .is_grammar_trigger = */ false,
|
||||||
});
|
});
|
||||||
assert_equal(antiprompts.findFirstMatch(" ab", 0), {
|
assert_equal(antiprompts.findFirstMatch(" ab", 0), {
|
||||||
.pos = 1,
|
/* .pos = */ 1,
|
||||||
.pattern = "",
|
/* .pattern = */ "",
|
||||||
.is_partial = true,
|
/* .is_partial = */ true,
|
||||||
.matchLength = 2,
|
/* .matchLength = */ 2,
|
||||||
.is_grammar_trigger = false,
|
/* .is_grammar_trigger = */ false,
|
||||||
});
|
});
|
||||||
assert_equal(antiprompts.findFirstMatch(" abc", 0), {
|
assert_equal(antiprompts.findFirstMatch(" abc", 0), {
|
||||||
.pos = 1,
|
/* .pos = */ 1,
|
||||||
.pattern = "abc",
|
/* .pattern = */ "abc",
|
||||||
.is_partial = false,
|
/* .is_partial = */ false,
|
||||||
.matchLength = 3,
|
/* .matchLength = */ 3,
|
||||||
.is_grammar_trigger = false,
|
/* .is_grammar_trigger = */ false,
|
||||||
});
|
});
|
||||||
assert_equal(antiprompts.findFirstMatch(" bc", 0), {
|
assert_equal(antiprompts.findFirstMatch(" bc", 0), {
|
||||||
.pos = 1,
|
/* .pos = */ 1,
|
||||||
.pattern = "",
|
/* .pattern = */ "",
|
||||||
.is_partial = true,
|
/* .is_partial = */ true,
|
||||||
.matchLength = 2,
|
/* .matchLength = */ 2,
|
||||||
.is_grammar_trigger = false,
|
/* .is_grammar_trigger = */ false,
|
||||||
});
|
});
|
||||||
assert_equal(antiprompts.findFirstMatch(" bcd", 0), {
|
assert_equal(antiprompts.findFirstMatch(" bcd", 0), {
|
||||||
.pos = 1,
|
/* .pos = */ 1,
|
||||||
.pattern = "bcd",
|
/* .pattern = */ "bcd",
|
||||||
.is_partial = false,
|
/* .is_partial = */ false,
|
||||||
.matchLength = 3,
|
/* .matchLength = */ 3,
|
||||||
.is_grammar_trigger = false,
|
/* .is_grammar_trigger = */ false,
|
||||||
});
|
});
|
||||||
assert_equal(antiprompts.findFirstMatch(" bca", 0), {
|
assert_equal(antiprompts.findFirstMatch(" bca", 0), {
|
||||||
.pos = 1,
|
/* .pos = */ 1,
|
||||||
.pattern = "bca",
|
/* .pattern = */ "bca",
|
||||||
.is_partial = false,
|
/* .is_partial = */ false,
|
||||||
.matchLength = 3,
|
/* .matchLength = */ 3,
|
||||||
.is_grammar_trigger = true,
|
/* .is_grammar_trigger = */ true,
|
||||||
});
|
});
|
||||||
printf("OK\n");
|
printf("OK\n");
|
||||||
// llama_antiprompts::MatchResult{0, "a", .is_partial = false, . 1, false});
|
// llama_antiprompts::MatchResult{0, "a", .is_partial = false, . 1, false});
|
||||||
|
Loading…
Reference in New Issue
Block a user