--- /dev/null
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "test_macros.h"
+#include "vcore/TimeConversion.h"
+
+using namespace ValidationCore;
+
+BOOST_AUTO_TEST_SUITE(TIME_CONVERSION_TEST)
+
+int convertToTimeT(const char *str, time_t *res_time)
+{
+ ASN1_TIME *asn1_time = new ASN1_TIME();
+ ASN1_TIME_set_string(asn1_time, str);
+
+ int result = asn1TimeToTimeT(asn1_time, res_time);
+
+ delete asn1_time;
+ return result;
+}
+
+POSITIVE_TEST_CASE(T_asn1_time_to_time_t)
+{
+ time_t res_time;
+ unsigned long expected_res_time = 1718668800;
+ BOOST_CHECK_EQUAL(convertToTimeT("240618000000Z", &res_time), 1);
+ BOOST_CHECK_EQUAL((unsigned long)res_time, expected_res_time);
+}
+
+NEGATIVE_TEST_CASE(T_asn1_time_to_time_t_wrong_parameter)
+{
+ time_t res_time;
+ BOOST_CHECK_EQUAL(convertToTimeT("240618000000Z", NULL), 0);
+ BOOST_CHECK_EQUAL(convertToTimeT("490618240000Z", &res_time), 0);
+}
+
+BOOST_AUTO_TEST_SUITE_END()