From 25ce179cbc0a8a2b1ff0ce8e28073bee95ab9179 Mon Sep 17 00:00:00 2001 From: vladislavbelov Date: Sun, 21 Nov 2021 11:59:02 +0000 Subject: [PATCH] Adds collision test for fnv_hash, removes unused include forgotten in b4a33851e6. This was SVN commit r26007. --- source/graphics/ColladaManager.cpp | 3 +-- source/lib/tests/test_fnv_hash.h | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/graphics/ColladaManager.cpp b/source/graphics/ColladaManager.cpp index 31d3daa562..25a7912e09 100644 --- a/source/graphics/ColladaManager.cpp +++ b/source/graphics/ColladaManager.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -22,7 +22,6 @@ #include #include "graphics/ModelDef.h" -#include "lib/fnv_hash.h" #include "maths/MD5.h" #include "ps/CacheLoader.h" #include "ps/CLogger.h" diff --git a/source/lib/tests/test_fnv_hash.h b/source/lib/tests/test_fnv_hash.h index ef768f3d51..bf8b09939e 100644 --- a/source/lib/tests/test_fnv_hash.h +++ b/source/lib/tests/test_fnv_hash.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2021 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -40,4 +40,11 @@ public: TS_ASSERT_EQUALS(h2, 0xD80BDA3FBE244A0Aull); // verify value for simple string TS_ASSERT_EQUALS(fnv_hash64("abcdef", 6), h2); // same result if hashing buffer } + + void test_collisions() + { + TS_ASSERT_EQUALS(fnv_hash("collisions", 10), fnv_hash("silage_formism", 14)); + TS_ASSERT_EQUALS(fnv_hash("2018-04-13 06:10", 16), fnv_hash("1984-05-01 06:20", 16)); + TS_ASSERT_EQUALS(fnv_hash("etude", 5), fnv_hash("nonassister", 11)); + } };