media/libyuv/unit_test/version_test.cc

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /*
michael@0 2 * Copyright 2012 The LibYuv Project Authors. All rights reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11 #include <stdlib.h>
michael@0 12 #include <string.h>
michael@0 13
michael@0 14 #include "libyuv/basic_types.h"
michael@0 15 #include "libyuv/version.h"
michael@0 16 #include "../unit_test/unit_test.h"
michael@0 17
michael@0 18 namespace libyuv {
michael@0 19
michael@0 20 // Tests SVN version against include/libyuv/version.h
michael@0 21 // SVN version is bumped by documentation changes as well as code.
michael@0 22 // Although the versions should match, once checked in, a tolerance is allowed.
michael@0 23 TEST_F(libyuvTest, TestVersion) {
michael@0 24 EXPECT_GE(LIBYUV_VERSION, 169); // 169 is first version to support version.
michael@0 25 printf("LIBYUV_VERSION %d\n", LIBYUV_VERSION);
michael@0 26 #ifdef LIBYUV_SVNREVISION
michael@0 27 const char *ver = strchr(LIBYUV_SVNREVISION, ':');
michael@0 28 if (ver) {
michael@0 29 ++ver;
michael@0 30 } else {
michael@0 31 ver = LIBYUV_SVNREVISION;
michael@0 32 }
michael@0 33 int svn_revision = atoi(ver); // NOLINT
michael@0 34 printf("LIBYUV_SVNREVISION %d\n", svn_revision);
michael@0 35 EXPECT_NEAR(LIBYUV_VERSION, svn_revision, 20); // Allow version to be close.
michael@0 36 if (LIBYUV_VERSION != svn_revision) {
michael@0 37 printf("WARNING - Versions do not match.\n");
michael@0 38 }
michael@0 39 #endif
michael@0 40 }
michael@0 41
michael@0 42 } // namespace libyuv

mercurial