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

Function test_realistic_cpp_header

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

Source from the content-addressed store, hash-verified

1197
1198 #[test]
1199 fn test_realistic_cpp_header() {
1200 let mut parser = CppParser::new();
1201 let source = r#"
1202#include <string>
1203#include <vector>
1204#include <memory>
1205
1206#define MAX_CONNECTIONS 100
1207#define API_VERSION "2.0"
1208
1209namespace net {
1210
1211enum class Protocol {
1212 TCP,
1213 UDP,
1214 HTTP
1215};
1216
1217using Callback = std::function<void(int)>;
1218
1219class Connection {
1220public:
1221 Connection(const std::string& host, int port);
1222 ~Connection();
1223
1224 void connect();
1225 void disconnect();
1226 bool is_connected() const;
1227
1228private:
1229 std::string host_;
1230 int port_;
1231};
1232
1233class Server {
1234public:
1235 void listen(int port) {
1236 port_ = port;
1237 }
1238
1239 void stop() {
1240 running_ = false;
1241 }
1242
1243private:
1244 int port_;
1245 bool running_;
1246 std::vector<std::unique_ptr<Connection>> connections_;
1247};
1248
1249struct Config {
1250 std::string host;
1251 int port;
1252 int max_connections;
1253};
1254
1255} // namespace net
1256"#;

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected