File: csv_parsing.cpp

package info (click to toggle)
glaze 6.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,312 kB
  • sloc: cpp: 109,539; sh: 99; ansic: 26; makefile: 13
file content (33 lines) | stat: -rw-r--r-- 705 bytes parent folder | download
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;
}