leetcode/tests/jianzhi_offer/node_test.cpp
2023-05-24 21:07:52 +08:00

14 lines
376 B
C++

#include <gtest/gtest.h>
#include "jianzhi_offer.h"
TEST(NodeTest, TestCopyRandomList) {
yaha::Node *head = new yaha::Node(1);
head->next = new yaha::Node(2);
head->next->next = new yaha::Node(3);
head->next->next->next = new yaha::Node(4);
yaha::Node *copy = head->copy_random_list(head);
ASSERT_EQ(copy->val, 4);
delete copy;
delete head;
}