From dfd7ce27fea04c1a76844e21286c2b1d6653e153 Mon Sep 17 00:00:00 2001 From: Jim Gibson Date: Mon, 20 Feb 2017 11:53:54 -0500 Subject: Initial Commit: VPP cicn VPP plugin Change-Id: If1b965f0a4b7cfacda8f6caf6925072a9007ffb4 Signed-off-by: Jim Gibson --- cicn-plugin/cicn/test/test_cicn_hash.h | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 cicn-plugin/cicn/test/test_cicn_hash.h (limited to 'cicn-plugin/cicn/test/test_cicn_hash.h') diff --git a/cicn-plugin/cicn/test/test_cicn_hash.h b/cicn-plugin/cicn/test/test_cicn_hash.h new file mode 100644 index 00000000..b173233a --- /dev/null +++ b/cicn-plugin/cicn/test/test_cicn_hash.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2017 Cisco and/or its affiliates. + * 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. + */ +/* + * UT for hash function. + */ +#include "test_cicn.h" + +#include +#include + +/* + * Store known-good comparison data. + * + * separate length to support chunk=0, but parser not yet ready for that + * (terminates on null byte) + */ +typedef struct test_cicn_hash_namedata_s +{ + char *th_name; + int th_namebytes; + int th_is_chunk_name; + cicn_prefix_hashinf_t th_pfx_hi; +} test_cicn_hash_namedata_t; + +#define TEST_CICN_HASH_NAMEDATA_FULL(str, is_chunk_name) \ + {.th_name = (str), .th_namebytes = sizeof(str)-1, .th_is_chunk_name = is_chunk_name, } +#define TEST_CICN_HASH_NAMEDATA(str) \ + TEST_CICN_HASH_NAMEDATA_FULL(str, 0/*is_chunk_name*/) + +extern test_cicn_hash_namedata_t hash_namedata_cdata[]; -- cgit 1.2.3-korg