blob: 51cde10092ea2d4d6d00eef384f68e55061fa777 [file] [log] [blame]
Keun young Park5eba08f2012-03-26 18:31:29 -07001/*
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
George Burgess IVc54dbdf2017-07-13 12:55:27 -070017#include <inttypes.h>
Keun young Park5eba08f2012-03-26 18:31:29 -070018#include <stdint.h>
19#include <gtest/gtest.h>
20
Keun young Park5eba08f2012-03-26 18:31:29 -070021#include "Log.h"
22
23
24
25class LogTest : public testing::Test {
26public:
27
28};
29
30
31TEST_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;
George Burgess IVc54dbdf2017-07-13 12:55:27 -070050#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);
Keun young Park5eba08f2012-03-26 18:31:29 -070058
59 Log::Instance()->setLogLevel(level);
60}
61
62
63