File: buffer.h

package info (click to toggle)
node-addon-api 8.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,248 kB
  • sloc: cpp: 15,431; javascript: 5,631; ansic: 157; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 519 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
#include <cstdint>
#include <cstdlib>

namespace test_buffer {

const size_t testLength = 4;
extern uint16_t testData[testLength];
extern int finalizeCount;

template <typename T>
void InitData(T* data, size_t length) {
  for (size_t i = 0; i < length; i++) {
    data[i] = static_cast<T>(i);
  }
}

template <typename T>
bool VerifyData(T* data, size_t length) {
  for (size_t i = 0; i < length; i++) {
    if (data[i] != static_cast<T>(i)) {
      return false;
    }
  }
  return true;
}
}  // namespace test_buffer