mcpp index

mcpplibs.openkal-kit

Facilities composed from openkal's interfaces, and not part of the specification

mcpp add mcpplibs.openkal-kit@0.3.2

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

// openkal-kit through the index: an endpoint parsed, written back and refused
// when malformed, which is the kit's behaviour and not only its declarations.
#include <cstdio>
#include <cstring>
import openkal.types;
import openkal.kit.endpoint;

int main() {
    using namespace kal::kit;
    int failures = 0;
    auto check = [&](bool held, const char* what) {
        if (!held) { std::printf("FAIL: %s\n", what); ++failures; }
    };
    const auto r = parse_v4("127.0.0.1:8080", 14);
    check(r.ok && r.ep.addr_len == 4 && r.ep.port == 8080, "an address with a port parses");
    char out[32];
    const auto f = format_v4(r.ep, out, sizeof out);
    check(f.ok && f.n == 14 && std::memcmp(out, "127.0.0.1:8080", 14) == 0,
          "and is written back as it was given");
    check(!parse_v4("256.0.0.1", 9).ok, "an octet past 255 is refused");
    check(!parse_v4("1.2.3", 5).ok, "three octets are refused");
    if (failures == 0) std::printf("openkal-kit: an endpoint parsed, written back and refused\n");
// …

tests/examples/openkal-kit/tests/kit.cpp · 專案 tests/examples/openkal-kit

建置 · 上游資訊清單

targets
openkal-kit (lib)
manifest version
0.3.2
dependencies
openkal
來源
https://raw.githubusercontent.com/mcpplibs/openkal/kit-0.3.2/kit/mcpp.toml

版本

版本平台 鏡像sha256
0.3.2 最新 LinuxWindowsmacOS GLOBAL CN 77215ebecc98…
0.3.1 LinuxWindowsmacOS GLOBAL CN 81cea3b8a749…
0.2.0 LinuxWindowsmacOS GLOBAL CN c93c5ce133e9…
0.1.1 LinuxWindowsmacOS GLOBAL CN 9c0e76317955…