1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libyuv/unit_test/version_test.cc Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +/* 1.5 + * Copyright 2012 The LibYuv Project Authors. All rights reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 +#include <stdlib.h> 1.15 +#include <string.h> 1.16 + 1.17 +#include "libyuv/basic_types.h" 1.18 +#include "libyuv/version.h" 1.19 +#include "../unit_test/unit_test.h" 1.20 + 1.21 +namespace libyuv { 1.22 + 1.23 +// Tests SVN version against include/libyuv/version.h 1.24 +// SVN version is bumped by documentation changes as well as code. 1.25 +// Although the versions should match, once checked in, a tolerance is allowed. 1.26 +TEST_F(libyuvTest, TestVersion) { 1.27 + EXPECT_GE(LIBYUV_VERSION, 169); // 169 is first version to support version. 1.28 + printf("LIBYUV_VERSION %d\n", LIBYUV_VERSION); 1.29 +#ifdef LIBYUV_SVNREVISION 1.30 + const char *ver = strchr(LIBYUV_SVNREVISION, ':'); 1.31 + if (ver) { 1.32 + ++ver; 1.33 + } else { 1.34 + ver = LIBYUV_SVNREVISION; 1.35 + } 1.36 + int svn_revision = atoi(ver); // NOLINT 1.37 + printf("LIBYUV_SVNREVISION %d\n", svn_revision); 1.38 + EXPECT_NEAR(LIBYUV_VERSION, svn_revision, 20); // Allow version to be close. 1.39 + if (LIBYUV_VERSION != svn_revision) { 1.40 + printf("WARNING - Versions do not match.\n"); 1.41 + } 1.42 +#endif 1.43 +} 1.44 + 1.45 +} // namespace libyuv