HappenLee commented on a change in pull request #6000:
URL: https://github.com/apache/incubator-doris/pull/6000#discussion_r647376150



##########
File path: be/test/exprs/timestamp_functions_test.cpp
##########
@@ -176,6 +176,101 @@ TEST_F(TimestampFunctionsTest, week_of_year_test) {
     delete context;
 }
 
+TEST_F(TimestampFunctionsTest, year_week_test) {
+    doris_udf::FunctionContext* context = new doris_udf::FunctionContext();
+
+    DateTimeValue dtv1(20210101000000);
+    dtv1.set_type(TIME_DATE);
+    doris_udf::DateTimeVal tv1;
+    dtv1.to_datetime_val(&tv1);
+    ASSERT_EQ(202052, TimestampFunctions::year_week(context, tv1).val);
+
+    DateTimeValue dtv2(20210103000000);
+    dtv2.set_type(TIME_DATE);
+    doris_udf::DateTimeVal tv2;
+    dtv2.to_datetime_val(&tv2);
+    ASSERT_EQ(  202101, TimestampFunctions::year_week(context, tv2).val);
+
+    DateTimeValue dtv3(20210501000000);
+    dtv3.set_type(TIME_DATE);
+    doris_udf::DateTimeVal tv3;
+    dtv3.to_datetime_val(&tv3);
+    ASSERT_EQ(  202117, TimestampFunctions::year_week(context, tv3).val);
+
+    DateTimeValue dtv4(20241230000000);
+    dtv4.set_type(TIME_DATE);
+    doris_udf::DateTimeVal tv4;
+    dtv4.to_datetime_val(&tv4);
+    ASSERT_EQ(  202501, TimestampFunctions::year_week(context, tv4, 1).val);

Review comment:
       please reformat the code,thank you




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to