1039
This commit is contained in:
45
tests/test_1039.cpp
Normal file
45
tests/test_1039.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
// This file is generated by mkfile.py
|
||||
// Date: 2025-09-29
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <solution/1039.h>
|
||||
|
||||
|
||||
class MinScoreTriangulationTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void AssertMinScoreTriangulation(std::vector<int> input, int expected)
|
||||
{
|
||||
int *values = new int[input.size()];
|
||||
std::copy(input.begin(), input.end(), values);
|
||||
|
||||
int result = minScoreTriangulation(values, input.size());
|
||||
ASSERT_EQ(result, expected);
|
||||
|
||||
delete[] values;
|
||||
}
|
||||
};
|
||||
|
||||
// 示例 1
|
||||
TEST_F(MinScoreTriangulationTest, Example1)
|
||||
{
|
||||
// 输入: values = [1,2,3]
|
||||
// 输出: 6
|
||||
AssertMinScoreTriangulation({1, 2, 3}, 6);
|
||||
}
|
||||
|
||||
// 示例 2
|
||||
TEST_F(MinScoreTriangulationTest, Example2)
|
||||
{
|
||||
// 输入: values = [3,7,4,5]
|
||||
// 输出: 144
|
||||
AssertMinScoreTriangulation({3, 7, 4, 5}, 144);
|
||||
}
|
||||
|
||||
// 示例 3
|
||||
TEST_F(MinScoreTriangulationTest, Example3)
|
||||
{
|
||||
// 输入: values = [1,3,1,4,1,5]
|
||||
// 输出: 13
|
||||
AssertMinScoreTriangulation({1, 3, 1, 4, 1, 5}, 13);
|
||||
}
|
||||
Reference in New Issue
Block a user