• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 
17 #include <inttypes.h>
18 #include <stdint.h>
19 #include <gtest/gtest.h>
20 
21 #include "Log.h"
22 
23 
24 
25 class LogTest : public testing::Test {
26 public:
27 
28 };
29 
30 
TEST_F(LogTest,logTest)31 TEST_F(LogTest, logTest) {
32     Log::LogLevel level = Log::Instance()->getLogLevel();
33 
34     // following lines should match. no automatic test yet..
35     // TODO make it automatic?
36     Log::Instance()->setLogLevel(Log::ELogV);
37     printf("printf %d %d %d %d %d %d\n", 0, 1, 2, 3, 4, 5);
38     LOGD(  "logd   %d %d %d %d %d %d", 0, 1, 2, 3, 4, 5);
39     LOGV(  "logv   %d %d %d %d %d %d", 0, 1, 2, 3, 4, 5);
40     LOGI(  "logi   %d %d %d %d %d %d", 0, 1, 2, 3, 4, 5);
41     LOGW(  "logw   %d %d %d %d %d %d", 0, 1, 2, 3, 4, 5);
42     LOGE(  "loge   %d %d %d %d %d %d", 0, 1, 2, 3, 4, 5);
43 
44     int64_t a = 0;
45     int64_t b = 1;
46     int64_t c = 2;
47     int64_t d = 3;
48     int64_t e = 4;
49     int64_t f = 5;
50 #define PrintABCDEF "%" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 \
51     " %" PRId64
52     printf("printf " PrintABCDEF "\n", a, b, c, d, e, f);
53     LOGD(  "logd   " PrintABCDEF, a, b, c, d, e, f);
54     LOGV(  "logv   " PrintABCDEF, a, b, c, d, e, f);
55     LOGI(  "logi   " PrintABCDEF, a, b, c, d, e, f);
56     LOGW(  "logw   " PrintABCDEF, a, b, c, d, e, f);
57     LOGE(  "loge   " PrintABCDEF, a, b, c, d, e, f);
58 
59     Log::Instance()->setLogLevel(level);
60 }
61 
62 
63 
64