File: csv_parsing.cpp

package info (click to toggle)
glaze 7.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 10,316 kB
  • sloc: cpp: 170,219; sh: 109; ansic: 26; makefile: 12
file content (33 lines) | stat: -rw-r--r-- 705 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <array>
#include <cstddef>
#include <cstdint>
#include <glaze/glaze.hpp>
#include <vector>

struct my_struct
{
   std::vector<int> num1{};
   std::deque<float> num2{};
   std::vector<bool> maybe{};
   std::vector<std::array<int, 3>> v3s{};
};

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size)
{
   if (Size < 1) return 0;

   const bool colwise = Data[0] & 0x1;
   Size -= 1;
   Data += 1;

   my_struct obj{};
   std::string_view input{(const char*)Data, Size};
   if (colwise) {
      [[maybe_unused]] auto parsed = glz::read_csv<glz::colwise>(obj, input);
   }
   else {
      [[maybe_unused]] auto parsed = glz::read_csv<glz::rowwise>(obj, input);
   }

   return 0;
}