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