2163
This commit is contained in:
11
include/solution/2163.h
Normal file
11
include/solution/2163.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef INC_2163_H
|
||||
#define INC_2163_H
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
long long minimumDifference(int *nums, int numsSize);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
4
src/2163.c
Normal file
4
src/2163.c
Normal file
@@ -0,0 +1,4 @@
|
||||
#include <solution/2163.h>
|
||||
long long minimumDifference(int *nums, int numsSize)
|
||||
{
|
||||
}
|
||||
26
tests/test_2163.cpp
Normal file
26
tests/test_2163.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <solution/2163.h>
|
||||
|
||||
class MinimumDifferenceTest : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void AssertMinimumDifference(std::vector<int> input, long long expected)
|
||||
{
|
||||
long long result = minimumDifference(input.data(), static_cast<int>(input.size()));
|
||||
EXPECT_EQ(result, expected);
|
||||
}
|
||||
};
|
||||
|
||||
// 示例 1
|
||||
TEST_F(MinimumDifferenceTest, Example1)
|
||||
{
|
||||
std::vector<int> nums = {3, 1, 2};
|
||||
AssertMinimumDifference(nums, -1);
|
||||
}
|
||||
|
||||
// 示例 2
|
||||
TEST_F(MinimumDifferenceTest, Example2)
|
||||
{
|
||||
std::vector<int> nums = {7, 9, 5, 8, 1, 3};
|
||||
AssertMinimumDifference(nums, 1);
|
||||
}
|
||||
Reference in New Issue
Block a user