Coverage Report

Created: 2025-07-01 06:18

/src/WasmEdge/include/host/mock/wasi_nn_func.h
Line
Count
Source (jump to first uncovered line)
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: 2019-2024 Second State INC
3
4
#pragma once
5
6
#include "common/errcode.h"
7
#include "host/mock/log.h"
8
#include "runtime/callingframe.h"
9
#include "runtime/hostfunc.h"
10
11
namespace WasmEdge {
12
namespace Host {
13
namespace WasiNNMock {
14
15
using namespace std::literals;
16
static inline constexpr const uint32_t kWASINNError = 1U;
17
18
class Load : public Runtime::HostFunction<Load> {
19
public:
20
  Expect<uint32_t> body(const Runtime::CallingFrame &, uint32_t, uint32_t,
21
0
                        uint32_t, uint32_t, uint32_t) {
22
0
    printPluginMock("WASI-NN"sv);
23
0
    return kWASINNError;
24
0
  }
25
};
26
27
class InitExecCtx : public Runtime::HostFunction<InitExecCtx> {
28
public:
29
0
  Expect<uint32_t> body(const Runtime::CallingFrame &, uint32_t, uint32_t) {
30
0
    printPluginMock("WASI-NN"sv);
31
0
    return kWASINNError;
32
0
  }
33
};
34
35
class SetInput : public Runtime::HostFunction<SetInput> {
36
public:
37
  Expect<uint32_t> body(const Runtime::CallingFrame &, uint32_t, uint32_t,
38
0
                        uint32_t) {
39
0
    printPluginMock("WASI-NN"sv);
40
0
    return kWASINNError;
41
0
  }
42
};
43
44
class GetOutput : public Runtime::HostFunction<GetOutput> {
45
public:
46
  Expect<uint32_t> body(const Runtime::CallingFrame &, uint32_t, uint32_t,
47
0
                        uint32_t, uint32_t, uint32_t) {
48
0
    printPluginMock("WASI-NN"sv);
49
0
    return kWASINNError;
50
0
  }
51
};
52
53
class Compute : public Runtime::HostFunction<Compute> {
54
public:
55
0
  Expect<uint32_t> body(const Runtime::CallingFrame &, uint32_t) {
56
0
    printPluginMock("WASI-NN"sv);
57
0
    return kWASINNError;
58
0
  }
59
};
60
61
} // namespace WasiNNMock
62
} // namespace Host
63
} // namespace WasmEdge