2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <dali/devel-api/common/hash.h>
21 #include <dali-test-suite-utils.h>
23 void utc_dali_hash_startup(void)
25 test_return_value = TET_UNDEF;
28 void utc_dali_hash_cleanup(void)
30 test_return_value = TET_PASS;
36 // To fully test the Hash distribution we need to use a tool like http://code.google.com/p/smhasher/
37 // DALi currently uses the hash for variable length strings which come from:
38 // shader vert+frag source, font family + style, image filename.
39 TestApplication application;
41 tet_infoline("UtcDaliHash");
43 const std::string testString1( "highp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );");
44 const std::string testString2( "lowp vec4 glowColor = vec4( uGlowColor.rgb, uGlowColor.a * clampedColor.a );");
46 DALI_TEST_CHECK( Dali::CalculateHash( testString1 ) != Dali::CalculateHash( testString2 ) );
47 DALI_TEST_CHECK( Dali::CalculateHash( testString1, testString2 ) != Dali::CalculateHash( testString2, testString1 ) );
52 int UtcDaliHashNegative(void)
54 // negative test, check hash value == initial value
55 const std::string emptyString;
57 DALI_TEST_CHECK( Dali::CalculateHash( emptyString ) != 0 );
58 DALI_TEST_CHECK( Dali::CalculateHash( emptyString, emptyString ) != 0 );