MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_realistic_cpp_header

Function test_realistic_cpp_header

atomic-semantic/src/parsers/cpp.rs:1222–1349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1220
1221 #[test]
1222 fn test_realistic_cpp_header() {
1223 let mut parser = CppParser::new();
1224 let source = r#"
1225#include <string>
1226#include <vector>
1227#include <memory>
1228
1229#define MAX_CONNECTIONS 100
1230#define API_VERSION "2.0"
1231
1232namespace net {
1233
1234enum class Protocol {
1235 TCP,
1236 UDP,
1237 HTTP
1238};
1239
1240using Callback = std::function<void(int)>;
1241
1242class Connection {
1243public:
1244 Connection(const std::string& host, int port);
1245 ~Connection();
1246
1247 void connect();
1248 void disconnect();
1249 bool is_connected() const;
1250
1251private:
1252 std::string host_;
1253 int port_;
1254};
1255
1256class Server {
1257public:
1258 void listen(int port) {
1259 port_ = port;
1260 }
1261
1262 void stop() {
1263 running_ = false;
1264 }
1265
1266private:
1267 int port_;
1268 bool running_;
1269 std::vector<std::unique_ptr<Connection>> connections_;
1270};
1271
1272struct Config {
1273 std::string host;
1274 int port;
1275 int max_connections;
1276};
1277
1278} // namespace net
1279"#;

Callers

nothing calls this directly

Calls 4

extractMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected