1# Copyright 2024 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 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 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_async2/backend.gni") 18import("$dir_pw_toolchain/traits.gni") 19import("$dir_pw_unit_test/test.gni") 20 21if (pw_toolchain_CXX_STANDARD >= pw_toolchain_STANDARD.CXX20) { 22 pw_test("basic") { 23 enable_if = pw_async2_DISPATCHER_BACKEND != "" 24 deps = [ 25 "$dir_pw_allocator:testing", 26 "$dir_pw_async2:coro", 27 "$dir_pw_async2:dispatcher", 28 ] 29 sources = [ "basic.cc" ] 30 } 31 32 # count-example-start 33 pw_executable("count") { 34 deps = [ 35 "$dir_pw_allocator:libc_allocator", 36 "$dir_pw_async2:allocate_task", 37 "$dir_pw_async2:coro", 38 "$dir_pw_async2:coro_or_else_task", 39 "$dir_pw_async2:dispatcher", 40 "$dir_pw_async2:system_time_provider", 41 "$dir_pw_chrono:system_clock", 42 "$dir_pw_log", 43 "$dir_pw_result", 44 "$dir_pw_status", 45 ] 46 sources = [ "count.cc" ] 47 } 48 49 # count-example-end 50 51 pw_test("coro_blinky_loop") { 52 enable_if = pw_async2_DISPATCHER_BACKEND != "" 53 sources = [ "coro_blinky_loop.cc" ] 54 deps = [ 55 "$dir_pw_allocator:testing", 56 "$dir_pw_async2:coro", 57 "$dir_pw_async2:dispatcher", 58 "$dir_pw_async2:simulated_time_provider", 59 "$dir_pw_async2:time_provider", 60 "$dir_pw_chrono:system_clock", 61 ] 62 } 63 64 pw_test("once_send_recv") { 65 enable_if = pw_async2_DISPATCHER_BACKEND != "" 66 deps = [ 67 "$dir_pw_allocator:testing", 68 "$dir_pw_async2:coro", 69 "$dir_pw_async2:dispatcher", 70 "$dir_pw_async2:once_sender", 71 ] 72 sources = [ "once_send_recv.cc" ] 73 } 74} 75 76pw_test_group("examples") { 77 tests = [] 78 if (pw_toolchain_CXX_STANDARD >= pw_toolchain_STANDARD.CXX20) { 79 tests += [ 80 ":basic", 81 ":coro_blinky_loop", 82 ":once_send_recv", 83 ] 84 } 85} 86