35 lines
898 B
C++
35 lines
898 B
C++
#include "core/device.hpp"
|
|
|
|
#include <cassert>
|
|
#include <vector>
|
|
|
|
int main() {
|
|
using mag160c::core::EndpointDescriptor;
|
|
using mag160c::core::EndpointPair;
|
|
using mag160c::core::EndpointType;
|
|
|
|
const std::vector<EndpointDescriptor> endpoints = {
|
|
{0x01, EndpointType::Interrupt},
|
|
{0x82, EndpointType::Bulk},
|
|
{0x03, EndpointType::Bulk},
|
|
};
|
|
|
|
EndpointPair pair{};
|
|
assert(mag160c::core::find_bulk_pair(endpoints, &pair));
|
|
assert(pair.bulk_in == 0x82);
|
|
assert(pair.bulk_out == 0x03);
|
|
|
|
const std::vector<EndpointDescriptor> missing_out = {
|
|
{0x82, EndpointType::Bulk},
|
|
};
|
|
|
|
pair = {};
|
|
assert(!mag160c::core::find_bulk_pair(missing_out, &pair));
|
|
assert(!mag160c::core::find_bulk_pair(endpoints, nullptr));
|
|
|
|
assert(mag160c::core::is_in_endpoint(0x82));
|
|
assert(!mag160c::core::is_in_endpoint(0x03));
|
|
|
|
return 0;
|
|
}
|