blob: 859f5f8785be57b52e18ff14e50abcbbf2eac7a9 [file] [log] [blame]
Alexei Frolovc10c8122019-11-01 16:31:19 -07001// Copyright 2019 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
Wyatt Hepler1a960942019-11-26 14:13:38 -08004// use this file except in compliance with the License. You may obtain a copy of
5// the License at
Alexei Frolovc10c8122019-11-01 16:31:19 -07006//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
Wyatt Hepler1a960942019-11-26 14:13:38 -080012// License for the specific language governing permissions and limitations under
13// the License.
Alexei Frolovc10c8122019-11-01 16:31:19 -070014
Armando Montanezd3ed0f42019-11-18 11:15:42 -080015#include <string_view>
Alexei Frolovc10c8122019-11-01 16:31:19 -070016
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080017#include "pw_span/span.h"
Armando Montanezf7a5a742020-03-02 14:58:59 -080018#include "pw_sys_io/sys_io.h"
Alexei Frolovc10c8122019-11-01 16:31:19 -070019#include "pw_unit_test/framework.h"
20#include "pw_unit_test/simple_printing_event_handler.h"
21
Alexei Frolovc10c8122019-11-01 16:31:19 -070022int main() {
23 pw::unit_test::SimplePrintingEventHandler handler(
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080024 [](const std::string_view& s, bool append_newline) {
25 if (append_newline) {
Armando Montanezf7a5a742020-03-02 14:58:59 -080026 pw::sys_io::WriteLine(s);
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080027 } else {
Armando Montanezf7a5a742020-03-02 14:58:59 -080028 pw::sys_io::WriteBytes(pw::as_bytes(pw::span(s)));
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080029 }
Armando Montanezd3ed0f42019-11-18 11:15:42 -080030 });
Wyatt Hepler8663e9c2019-11-20 13:58:29 -080031
Alexei Frolovc10c8122019-11-01 16:31:19 -070032 pw::unit_test::RegisterEventHandler(&handler);
33 return RUN_ALL_TESTS();
34}