blob: 5aeab45787adefc05b5a79400e4b5c9fb3b20ae4 [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
Wyatt Heplere2cbadf2020-06-22 11:21:45 -070015#include <span>
Armando Montanezd3ed0f42019-11-18 11:15:42 -080016#include <string_view>
Alexei Frolovc10c8122019-11-01 16:31:19 -070017
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 {
Wyatt Heplere2cbadf2020-06-22 11:21:45 -070028 pw::sys_io::WriteBytes(std::as_bytes(std::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}