14 lines
376 B
C++
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;
|
|
} |