Skip to content

Commit 50bcf7a

Browse files
author
AstroAir
committed
Add comprehensive unit tests for socket functionality and validation script for test coverage
- Implemented a new test suite for socket operations in `test_socket.hpp`, covering initialization, creation, binding, non-blocking mode, connection timeouts, performance, and error handling. - Added a PowerShell script `validate_test_coverage.ps1` to validate test file existence, analyze test file sizes, compile tests, and generate a detailed report on test coverage and features. - Enhanced test coverage with over 400 test cases, ensuring robust validation of the Atom Web module's socket functionalities and overall integration.
1 parent 3f24d21 commit 50bcf7a

290 files changed

Lines changed: 70141 additions & 15560 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.augment/rules/update-python.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
type: "manual"
3+
---
4+
5+
I will provide you with two folders shortly. I need you to systematically update Python bindings in the second folder based on the C++ modules in the first folder. For each C++ module, please:
6+
7+
1. **Complete Interface Exposure**: Ensure every public class, method, function, property, and enum from the C++ module is properly exposed in the corresponding Python binding file
8+
2. **Functional Completeness**: Verify that all C++ functionality is accessible from Python, including:
9+
- All public methods and their overloads
10+
- All constructors and destructors
11+
- All static methods and properties
12+
- All enums and constants
13+
- All operator overloads where applicable
14+
3. **Comprehensive English Documentation**: Add complete English docstrings for:
15+
- Every exposed class with description of its purpose
16+
- Every method with parameter descriptions, return value descriptions, and usage examples where helpful
17+
- Every property with description of what it represents
18+
- Every enum value with its meaning
19+
4. **Module-by-Module Processing**: Process each C++ module individually and update its corresponding Python binding file
20+
5. **Consistency**: Ensure naming conventions and documentation style are consistent across all binding files
21+
6. **Error Handling**: Properly handle C++ exceptions and convert them to appropriate Python exceptions
22+
23+
Please work through each module systematically, and let me know when you've completed each one so I can review the changes before proceeding to the next module.

.claude/settings.local.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(cmake:*)",
5+
"Bash(xmake:*)",
6+
"Bash(pkg-config:*)",
7+
"Bash(pacman:*)",
8+
"Read(//d/msys64/mingw64/bin/**)",
9+
"Read(//d/msys64/mingw64/**)",
10+
"Bash(./scripts/build.sh:*)",
11+
"Read(//d/msys64/**)",
12+
"Bash(grep:*)",
13+
"Bash(g++:*)",
14+
"Bash(ninja:*)",
15+
"Bash(D:/msys64/usr/bin/pacman:*)",
16+
"Bash(find:*)",
17+
"Bash(./build/cmake-release/example/async/async_async_executor.exe:*)",
18+
"Bash(./async_async_executor.exe)",
19+
"Bash(./atom_async_tests.exe:*)",
20+
"Bash(make:*)",
21+
"Bash(mingw32-make:*)",
22+
"Bash(python:*)",
23+
"Bash(./cmake-release/example/components/components_command_dispatch_example.exe:*)",
24+
"Bash(timeout:*)",
25+
"Bash(./cmake-release/example/components/components_comprehensive_integration_example.exe:*)",
26+
"Bash(ldd:*)",
27+
"Bash(PATH:*)"
28+
],
29+
"deny": [],
30+
"ask": []
31+
}
32+
}

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
## Build, Test, and Development Commands
1111
- C++ build (Ninja default): `cmake --preset release && cmake --build --preset release -j`
1212
- C++ tests: `cmake --preset debug && cmake --build --preset debug -j && ctest --preset default --output-on-failure`
13-
- Cross‑platform scripts: `./build.sh` (Unix) or `build.bat` (Windows)
13+
- Cross‑platform scripts: `./build.sh` (Unix) or `build.bat` (Windows) - wrapper scripts for backward compatibility
14+
- Direct script access: `./scripts/build.sh` (Unix) or `scripts\build.bat` (Windows) - actual build scripts
1415
- Python dev setup: `pip install -e .[dev]`
1516
- Python tests: `pytest -q` (coverage configured via `pyproject.toml`)
1617
- Docs: Sphinx `sphinx-build -b html docs docs/_build`; Doxygen `doxygen Doxyfile`

CLAUDE.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
**Atom** is a foundational C++ library for astronomical software development. It provides a comprehensive set of modules for algorithmic operations, image processing, system integration, and more. The project is designed as a modular framework with optional components that can be selectively built based on requirements.
8+
9+
## Build System
10+
11+
### Primary Build Commands
12+
13+
The project uses CMake as the primary build system with enhanced build scripts:
14+
15+
- **Standard build**: `./scripts/build.sh` (Linux/macOS) or `scripts\build.bat` (Windows)
16+
- **Debug build**: `./scripts/build.sh --debug`
17+
- **Release with tests**: `./scripts/build.sh --release --tests --run-tests`
18+
- **Build with Python bindings**: `./scripts/build.sh --python`
19+
- **Build examples**: `./scripts/build.sh --examples`
20+
- **Clean build**: `./scripts/build.sh --clean`
21+
22+
### Build System Features
23+
24+
The enhanced build scripts support:
25+
- Multiple build types (debug, release, relwithdebinfo)
26+
- Parallel compilation with automatic CPU detection
27+
- System dependency installation
28+
- Package creation for distribution
29+
- Documentation generation with Doxygen
30+
- Cross-platform support (Linux, macOS, Windows)
31+
32+
### Module-Based Building
33+
34+
You can selectively build modules using CMake options:
35+
- `ATOM_BUILD_ALGORITHM=ON/OFF` - Algorithm and mathematical operations
36+
- `ATOM_BUILD_IMAGE=ON/OFF` - Image processing and computer vision
37+
- `ATOM_BUILD_ASYNC=ON/OFF` - Asynchronous operations
38+
- `ATOM_BUILD_CONNECTION=ON/OFF` - Network and communication
39+
- `ATOM_BUILD_ERROR=ON/OFF` - Error handling system
40+
- `ATOM_BUILD_UTILS=ON/OFF` - Utility functions
41+
- And more...
42+
43+
### Testing
44+
45+
- **Build tests**: `./scripts/build.sh --tests`
46+
- **Run tests**: `./scripts/build.sh --tests --run-tests`
47+
- **Run specific test categories**: Use CMake targets like `test_core_modules`, `test_io_modules`
48+
49+
## Architecture
50+
51+
### Module Structure
52+
53+
Atom is organized into modular components under `atom/`:
54+
55+
- **algorithm/**: Mathematical algorithms, cryptography, signal processing
56+
- **image/**: Complete image processing pipeline with astronomical format support (FITS, SER)
57+
- **async/**: Asynchronous programming primitives and concurrency utilities
58+
- **connection/**: Network communication (TCP, UDP, SSH)
59+
- **error/**: Comprehensive error handling and stack trace system
60+
- **io/**: Input/output operations and file system utilities
61+
- **system/**: System-level integration and platform-specific code
62+
- **utils/**: General utility functions and helpers
63+
- **web/**: HTTP client and web-related utilities
64+
65+
### Key Dependencies
66+
67+
- **OpenSSL**: Cryptographic operations (algorithm module)
68+
- **OpenCV**: Computer vision and image processing (image module)
69+
- **CFITSIO**: FITS file format support (image module, optional)
70+
- **Tesseract**: OCR capabilities (image module, optional)
71+
- **loguru**: Logging framework
72+
- **GTest**: Unit testing framework
73+
74+
### Python Bindings
75+
76+
Python bindings are available for most modules using pybind11:
77+
- Enable with `--python` flag or `ATOM_BUILD_PYTHON_BINDINGS=ON`
78+
- Bindings are located in `python/` directory
79+
- Each module has corresponding Python binding files
80+
81+
## Development Workflow
82+
83+
### Adding New Code
84+
85+
1. **Module Selection**: Add code to appropriate module under `atom/`
86+
2. **Dependencies**: Update `CMakeLists.txt` for any new dependencies
87+
3. **Headers**: Place public headers in module root, implementation in subdirectories
88+
4. **Tests**: Add corresponding tests under `tests/[module]/`
89+
5. **Examples**: Consider adding examples under `example/[module]/`
90+
91+
### Build Options
92+
93+
The project supports extensive configuration via CMake options and command-line flags. Check the main `CMakeLists.txt` for complete list of available options.
94+
95+
### Error Handling
96+
97+
Atom uses a comprehensive error handling system centered in the `error` module. All modules should integrate with this system for consistent error reporting and stack trace generation.
98+
99+
## Important Notes
100+
101+
- **vcpkg**: Currently disabled due to network issues, but configuration is available
102+
- **C++ Standard**: Uses C++20 by default, C++23 when available
103+
- **Platform Support**: Windows (MSVC), Linux (GCC/Clang), macOS (Clang)
104+
- **Modular Design**: Each module can be built independently to reduce binary size
105+
- **Astronomical Focus**: Specialized support for astronomical image formats and processing
106+
107+
## Common Development Tasks
108+
109+
### Building a Single Module
110+
```bash
111+
cmake -B build -DATOM_BUILD_ALGORITHM=ON -DATOM_BUILD_TESTS=ON
112+
cmake --build build
113+
```
114+
115+
### Running Specific Tests
116+
```bash
117+
cd build
118+
ctest -R "algorithm_*" --output-on-failure
119+
```
120+
121+
### Building with All Features
122+
```bash
123+
./scripts/build.sh --release --python --examples --tests --docs --package
124+
```

CMakeLists.txt

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2727
include(cmake/GitVersion.cmake)
2828
include(cmake/VersionConfig.cmake)
2929
include(cmake/PlatformSpecifics.cmake)
30-
include(cmake/compiler_options.cmake)
30+
include(cmake/CompilerOptions.cmake)
3131
include(cmake/module_dependencies.cmake)
3232
include(cmake/ExamplesBuildOptions.cmake)
3333
include(cmake/TestsBuildOptions.cmake)
@@ -152,7 +152,7 @@ include_directories(
152152
add_custom_target(
153153
AtomCmakeAdditionalFiles
154154
SOURCES
155-
${CMAKE_CURRENT_SOURCE_DIR}/cmake/compiler_options.cmake
155+
${CMAKE_CURRENT_SOURCE_DIR}/cmake/CompilerOptions.cmake
156156
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GitVersion.cmake
157157
)
158158

@@ -214,28 +214,6 @@ endif()
214214
# endif()
215215
# endif()
216216

217-
# include(WSLDetection)
218-
# detect_wsl(IS_WSL)
219-
# if(IS_WSL)
220-
# message(STATUS "Running in WSL environment")
221-
# pkg_check_modules(CURL REQUIRED libcurl)
222-
# if(CURL_FOUND)
223-
# include_directories(${CURL_INCLUDE_DIRS})
224-
# link_directories(${CURL_LIBRARY_DIRS})
225-
# else()
226-
# message(FATAL_ERROR "curl development files not found. Please install libcurl-dev or equivalent.")
227-
# endif()
228-
# else()
229-
# message(STATUS "Not running in WSL environment")
230-
# find_package(CURL REQUIRED)
231-
# if(CURL_FOUND)
232-
# include_directories(${CURL_INCLUDE_DIRS})
233-
# message(STATUS "Found CURL: ${CURL_VERSION} (${CURL_INCLUDE_DIRS})")
234-
# else()
235-
# message(FATAL_ERROR "curl development files not found. Please install libcurl-dev or equivalent.")
236-
# endif()
237-
# endif()
238-
239217
# Skip Boost for now
240218
# Boost
241219
# if(ATOM_USE_BOOST)
@@ -287,6 +265,7 @@ if(ATOM_BUILD_PYTHON_BINDINGS)
287265
add_subdirectory(python)
288266
endif()
289267
if(ATOM_BUILD_TESTS)
268+
enable_testing()
290269
add_subdirectory(tests)
291270
endif()
292271

atom/components/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,15 @@ link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../build/atom/type)
131131
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../build/atom/log)
132132
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../build/extra)
133133

134+
# Find fmt if not already found
135+
if(NOT TARGET fmt::fmt)
136+
find_package(fmt QUIET)
137+
endif()
138+
134139
set(LIBS
135140
atom-error
136141
loguru
137-
${CMAKE_CURRENT_SOURCE_DIR}/../../libfmt-11.dll
142+
$<$<TARGET_EXISTS:fmt::fmt>:fmt::fmt>
138143
${CMAKE_THREAD_LIBS_INIT}
139144
)
140145

0 commit comments

Comments
 (0)