Compare commits
2 Commits
dc222231e6
...
cf633352b5
| Author | SHA1 | Date | |
|---|---|---|---|
| cf633352b5 | |||
| 45162bb934 |
@@ -7,6 +7,10 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|||||||
set(GTEST_VERSION 1.17.0)
|
set(GTEST_VERSION 1.17.0)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
message(FATAL_ERROR "MSVC is not supported. Please use GCC or Clang.")
|
||||||
|
endif ()
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|||||||
14
include/solution/1137.h
Normal file
14
include/solution/1137.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
// This file is generated by mkfile.py
|
||||||
|
// Date: 2025-12-05
|
||||||
|
|
||||||
|
#ifndef INC_1137_H
|
||||||
|
#define INC_1137_H
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
int tribonacci(int n);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif // INC_1137_H
|
||||||
7
src/1137.c
Normal file
7
src/1137.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// This file is generated by mkfile.py
|
||||||
|
// Date: 2025-12-05
|
||||||
|
|
||||||
|
#include <solution/1137.h>
|
||||||
|
int tribonacci(int n)
|
||||||
|
{
|
||||||
|
}
|
||||||
41
tests/test_1137.cpp
Normal file
41
tests/test_1137.cpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
// This file is generated by mkfile.py
|
||||||
|
// Date: 2025-12-05
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <solution/1137.h>
|
||||||
|
|
||||||
|
// Tests for tribonacci (LeetCode 1137)
|
||||||
|
class TribonacciTest : public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
void AssertTribo(int n, int expected)
|
||||||
|
{
|
||||||
|
ASSERT_EQ(tribonacci(n), expected);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, BaseCases)
|
||||||
|
{
|
||||||
|
AssertTribo(0, 0);
|
||||||
|
AssertTribo(1, 1);
|
||||||
|
AssertTribo(2, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, SmallNumbers)
|
||||||
|
{
|
||||||
|
AssertTribo(3, 2);
|
||||||
|
AssertTribo(4, 4);
|
||||||
|
AssertTribo(5, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, MediumNumbers)
|
||||||
|
{
|
||||||
|
AssertTribo(10, 149);
|
||||||
|
AssertTribo(15, 3136);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(TribonacciTest, UpperBound)
|
||||||
|
{
|
||||||
|
AssertTribo(25, 1389537);
|
||||||
|
AssertTribo(37, 2082876103);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user