| // WARNING: This file is machine generated by fidlgen. |
| |
| // fidl_experiment = output_index_json |
| |
| #pragma once |
| |
| #include <test/consts/cpp/fidl.h> |
| |
| #include "lib/fidl/cpp/fuzzing/traits.h" |
| #include "lib/fidl/cpp/internal/header.h" |
| // For ::std::max_element(). |
| #include <algorithm> |
| // For uint64_t. |
| #include <stdint.h> |
| |
| namespace fuzzing { |
| |
| using EnumType = ::test::consts::EnumType; |
| using BitsType = ::test::consts::BitsType; |
| |
| template <> |
| struct MinSize<EnumType> { |
| operator size_t() { return sizeof(uint64_t); } |
| }; |
| template <> |
| struct Allocate<EnumType> { |
| EnumType operator()(FuzzInput* src, size_t* size) { |
| EnumType out; |
| uint64_t selector; |
| ZX_ASSERT(*size >= sizeof(uint64_t)); |
| ZX_ASSERT(src->CopyObject(&selector)); |
| *size = sizeof(uint64_t); |
| |
| switch (selector % 2) { |
| case 0: |
| out = EnumType::VALUE; |
| break; |
| case 1: |
| out = EnumType::true_; |
| break; |
| } |
| |
| return out; |
| } |
| }; |
| template <> |
| struct MinSize<BitsType> { |
| operator size_t() { return sizeof(BitsType); } |
| }; |
| template <> |
| struct Allocate<BitsType> { |
| BitsType operator()(FuzzInput* src, size_t* size) { |
| BitsType out; |
| ZX_ASSERT(*size >= sizeof(BitsType)); |
| ZX_ASSERT(src->CopyObject(&out)); |
| *size = sizeof(BitsType); |
| return out; |
| } |
| }; |
| |
| } // namespace fuzzing |