/* * Copyright (c) 2000 - 2015 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 * * * @file wae_tests.c * @author Dongsun Lee (ds73.lee@samsung.com) * @version 1.0 * @brief internal test cases for libwebappenc. */ #include #include #include #include #include "web_app_enc.h" #include "key_handler.h" #include "crypto_service.h" #include static int tc_seq = 0; static int tc_succ = 0; static int tc_fail = 0; #define FPRINTF(format, args...) fprintf(stdout, format, ##args) static int RUNTC(int (*tc_method)(), const char* tc_name) { int ret = WAE_ERROR_NONE; FPRINTF("[%02d:%s]started...\n", tc_seq, tc_name); ret = tc_method(); if(ret == WAE_ERROR_NONE) { FPRINTF("[%02d:%s]ended. SUCCESS\n\n", tc_seq, tc_name); tc_succ++; } else { FPRINTF("[%02d:%s]ended. FAIL. error=%d\n\n", tc_seq, tc_name, ret); tc_fail++; } tc_seq++; return ret; } static void PRINT_TC_SUMMARY() { FPRINTF("\n"); FPRINTF("===============================================\n"); FPRINTF(" TOTAL = %d, SUCCESS = %d, FAIL = %d\n", tc_seq, tc_succ, tc_fail); FPRINTF("===============================================\n"); } void _print_binary_to_hex(const char* msg, unsigned char* bin, size_t len) { size_t i = 0; FPRINTF("%s", msg); for(i=0; i