Spaces:
Running
Running
Delete cpp
Browse files- cpp/CMakeLists.txt +0 -34
- cpp/build/CMakeCache.txt +0 -98
- cpp/build/CMakeFiles/3.29.3/CMakeSystem.cmake +0 -15
- cpp/build/CMakeFiles/CMakeConfigureLog.yaml +0 -11
- cpp/build/CMakeFiles/cmake.check_cache +0 -1
- cpp/include/dag_engine.h +0 -57
- cpp/src/dag_engine.cpp +0 -91
- cpp/src/main.cpp +0 -32
- cpp/tests/test_dag.cpp +0 -75
cpp/CMakeLists.txt
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
cmake_minimum_required(VERSION 3.16)
|
| 2 |
-
project(AutoForgeDAG VERSION 0.1.0 LANGUAGES CXX)
|
| 3 |
-
|
| 4 |
-
set(CMAKE_CXX_STANDARD 17)
|
| 5 |
-
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
| 6 |
-
set(CMAKE_CXX_EXTENSIONS OFF)
|
| 7 |
-
|
| 8 |
-
# ── Main executable ──────────────────────────
|
| 9 |
-
|
| 10 |
-
add_executable(autoforge-dag
|
| 11 |
-
src/main.cpp
|
| 12 |
-
src/dag_engine.cpp
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
target_include_directories(autoforge-dag PRIVATE include)
|
| 16 |
-
|
| 17 |
-
# ── Test executable ──────────────────────────
|
| 18 |
-
|
| 19 |
-
add_executable(autoforge-dag-test
|
| 20 |
-
tests/test_dag.cpp
|
| 21 |
-
src/dag_engine.cpp
|
| 22 |
-
)
|
| 23 |
-
|
| 24 |
-
target_include_directories(autoforge-dag-test PRIVATE include)
|
| 25 |
-
|
| 26 |
-
# Threading support
|
| 27 |
-
find_package(Threads REQUIRED)
|
| 28 |
-
target_link_libraries(autoforge-dag Threads::Threads)
|
| 29 |
-
target_link_libraries(autoforge-dag-test Threads::Threads)
|
| 30 |
-
|
| 31 |
-
# ── CTest ────────────────────────────────────
|
| 32 |
-
|
| 33 |
-
enable_testing()
|
| 34 |
-
add_test(NAME DAGEngineTest COMMAND autoforge-dag-test)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/build/CMakeCache.txt
DELETED
|
@@ -1,98 +0,0 @@
|
|
| 1 |
-
# This is the CMakeCache file.
|
| 2 |
-
# For build in directory: c:/Users/Admin/OneDrive/Desktop/AutoForge/cpp/build
|
| 3 |
-
# It was generated by CMake: C:/Program Files/CMake/bin/cmake.exe
|
| 4 |
-
# You can edit this file to change values found and used by cmake.
|
| 5 |
-
# If you do not want to change any of the values, simply exit the editor.
|
| 6 |
-
# If you do want to change a value, simply edit, save, and exit the editor.
|
| 7 |
-
# The syntax for the file is as follows:
|
| 8 |
-
# KEY:TYPE=VALUE
|
| 9 |
-
# KEY is the name of a variable in the cache.
|
| 10 |
-
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
|
| 11 |
-
# VALUE is the current value for the KEY.
|
| 12 |
-
|
| 13 |
-
########################
|
| 14 |
-
# EXTERNAL cache entries
|
| 15 |
-
########################
|
| 16 |
-
|
| 17 |
-
//Value Computed by CMake
|
| 18 |
-
AutoForgeDAG_BINARY_DIR:STATIC=C:/Users/Admin/OneDrive/Desktop/AutoForge/cpp/build
|
| 19 |
-
|
| 20 |
-
//Value Computed by CMake
|
| 21 |
-
AutoForgeDAG_IS_TOP_LEVEL:STATIC=ON
|
| 22 |
-
|
| 23 |
-
//Value Computed by CMake
|
| 24 |
-
AutoForgeDAG_SOURCE_DIR:STATIC=C:/Users/Admin/OneDrive/Desktop/AutoForge/cpp
|
| 25 |
-
|
| 26 |
-
//Value Computed by CMake.
|
| 27 |
-
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=C:/Users/Admin/OneDrive/Desktop/AutoForge/cpp/build/CMakeFiles/pkgRedirects
|
| 28 |
-
|
| 29 |
-
//Program used to build from makefiles.
|
| 30 |
-
CMAKE_MAKE_PROGRAM:STRING=nmake
|
| 31 |
-
|
| 32 |
-
//Value Computed by CMake
|
| 33 |
-
CMAKE_PROJECT_DESCRIPTION:STATIC=
|
| 34 |
-
|
| 35 |
-
//Value Computed by CMake
|
| 36 |
-
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
|
| 37 |
-
|
| 38 |
-
//Value Computed by CMake
|
| 39 |
-
CMAKE_PROJECT_NAME:STATIC=AutoForgeDAG
|
| 40 |
-
|
| 41 |
-
//Value Computed by CMake
|
| 42 |
-
CMAKE_PROJECT_VERSION:STATIC=0.1.0
|
| 43 |
-
|
| 44 |
-
//Value Computed by CMake
|
| 45 |
-
CMAKE_PROJECT_VERSION_MAJOR:STATIC=0
|
| 46 |
-
|
| 47 |
-
//Value Computed by CMake
|
| 48 |
-
CMAKE_PROJECT_VERSION_MINOR:STATIC=1
|
| 49 |
-
|
| 50 |
-
//Value Computed by CMake
|
| 51 |
-
CMAKE_PROJECT_VERSION_PATCH:STATIC=0
|
| 52 |
-
|
| 53 |
-
//Value Computed by CMake
|
| 54 |
-
CMAKE_PROJECT_VERSION_TWEAK:STATIC=
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
########################
|
| 58 |
-
# INTERNAL cache entries
|
| 59 |
-
########################
|
| 60 |
-
|
| 61 |
-
//This is the directory where this CMakeCache.txt was created
|
| 62 |
-
CMAKE_CACHEFILE_DIR:INTERNAL=c:/Users/Admin/OneDrive/Desktop/AutoForge/cpp/build
|
| 63 |
-
//Major version of cmake used to create the current loaded cache
|
| 64 |
-
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
|
| 65 |
-
//Minor version of cmake used to create the current loaded cache
|
| 66 |
-
CMAKE_CACHE_MINOR_VERSION:INTERNAL=29
|
| 67 |
-
//Patch version of cmake used to create the current loaded cache
|
| 68 |
-
CMAKE_CACHE_PATCH_VERSION:INTERNAL=3
|
| 69 |
-
//Path to CMake executable.
|
| 70 |
-
CMAKE_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cmake.exe
|
| 71 |
-
//Path to cpack program executable.
|
| 72 |
-
CMAKE_CPACK_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cpack.exe
|
| 73 |
-
//Path to ctest program executable.
|
| 74 |
-
CMAKE_CTEST_COMMAND:INTERNAL=C:/Program Files/CMake/bin/ctest.exe
|
| 75 |
-
//Path to cache edit program executable.
|
| 76 |
-
CMAKE_EDIT_COMMAND:INTERNAL=C:/Program Files/CMake/bin/cmake-gui.exe
|
| 77 |
-
//Name of external makefile project generator.
|
| 78 |
-
CMAKE_EXTRA_GENERATOR:INTERNAL=
|
| 79 |
-
//Name of generator.
|
| 80 |
-
CMAKE_GENERATOR:INTERNAL=NMake Makefiles
|
| 81 |
-
//Generator instance identifier.
|
| 82 |
-
CMAKE_GENERATOR_INSTANCE:INTERNAL=
|
| 83 |
-
//Name of generator platform.
|
| 84 |
-
CMAKE_GENERATOR_PLATFORM:INTERNAL=
|
| 85 |
-
//Name of generator toolset.
|
| 86 |
-
CMAKE_GENERATOR_TOOLSET:INTERNAL=
|
| 87 |
-
//Source directory with the top level CMakeLists.txt file for this
|
| 88 |
-
// project
|
| 89 |
-
CMAKE_HOME_DIRECTORY:INTERNAL=C:/Users/Admin/OneDrive/Desktop/AutoForge/cpp
|
| 90 |
-
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
|
| 91 |
-
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
|
| 92 |
-
//number of local generators
|
| 93 |
-
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
|
| 94 |
-
//Platform information initialized
|
| 95 |
-
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
|
| 96 |
-
//Path to CMake installation.
|
| 97 |
-
CMAKE_ROOT:INTERNAL=C:/Program Files/CMake/share/cmake-3.29
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/build/CMakeFiles/3.29.3/CMakeSystem.cmake
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
set(CMAKE_HOST_SYSTEM "Windows-10.0.26200")
|
| 2 |
-
set(CMAKE_HOST_SYSTEM_NAME "Windows")
|
| 3 |
-
set(CMAKE_HOST_SYSTEM_VERSION "10.0.26200")
|
| 4 |
-
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
set(CMAKE_SYSTEM "Windows-10.0.26200")
|
| 9 |
-
set(CMAKE_SYSTEM_NAME "Windows")
|
| 10 |
-
set(CMAKE_SYSTEM_VERSION "10.0.26200")
|
| 11 |
-
set(CMAKE_SYSTEM_PROCESSOR "AMD64")
|
| 12 |
-
|
| 13 |
-
set(CMAKE_CROSSCOMPILING "FALSE")
|
| 14 |
-
|
| 15 |
-
set(CMAKE_SYSTEM_LOADED 1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/build/CMakeFiles/CMakeConfigureLog.yaml
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
---
|
| 3 |
-
events:
|
| 4 |
-
-
|
| 5 |
-
kind: "message-v1"
|
| 6 |
-
backtrace:
|
| 7 |
-
- "C:/Program Files/CMake/share/cmake-3.29/Modules/CMakeDetermineSystem.cmake:205 (message)"
|
| 8 |
-
- "CMakeLists.txt:2 (project)"
|
| 9 |
-
message: |
|
| 10 |
-
The system is: Windows - 10.0.26200 - AMD64
|
| 11 |
-
...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/build/CMakeFiles/cmake.check_cache
DELETED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
|
|
|
|
|
cpp/include/dag_engine.h
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
#pragma once
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* AutoForge DAG Engine
|
| 5 |
-
*
|
| 6 |
-
* Minimal skeleton for Phase 1.
|
| 7 |
-
* Full task scheduling will be implemented in Phase 2.
|
| 8 |
-
*/
|
| 9 |
-
|
| 10 |
-
#include <string>
|
| 11 |
-
#include <vector>
|
| 12 |
-
#include <unordered_map>
|
| 13 |
-
#include <functional>
|
| 14 |
-
#include <mutex>
|
| 15 |
-
|
| 16 |
-
namespace autoforge {
|
| 17 |
-
|
| 18 |
-
/// Represents a single node in the execution DAG.
|
| 19 |
-
struct DAGNode {
|
| 20 |
-
std::string id;
|
| 21 |
-
std::string name;
|
| 22 |
-
std::string type; // e.g., "plan", "code", "test", "analyze"
|
| 23 |
-
std::vector<std::string> deps; // IDs of dependency nodes
|
| 24 |
-
};
|
| 25 |
-
|
| 26 |
-
/// DAG execution engine — schedules and runs task nodes.
|
| 27 |
-
class DAGEngine {
|
| 28 |
-
public:
|
| 29 |
-
DAGEngine();
|
| 30 |
-
~DAGEngine();
|
| 31 |
-
|
| 32 |
-
/// Get the engine version string.
|
| 33 |
-
static std::string version();
|
| 34 |
-
|
| 35 |
-
/// Add a node to the DAG.
|
| 36 |
-
void add_node(const DAGNode& node);
|
| 37 |
-
|
| 38 |
-
/// Get the number of nodes in the DAG.
|
| 39 |
-
size_t node_count() const;
|
| 40 |
-
|
| 41 |
-
/// Clear all nodes.
|
| 42 |
-
void clear();
|
| 43 |
-
|
| 44 |
-
/// Validate that the DAG has no cycles. Returns true if valid.
|
| 45 |
-
bool validate() const;
|
| 46 |
-
|
| 47 |
-
/// Execute the DAG (Phase 2 — currently a no-op).
|
| 48 |
-
/// Returns true on success.
|
| 49 |
-
bool execute();
|
| 50 |
-
|
| 51 |
-
private:
|
| 52 |
-
std::vector<DAGNode> nodes_;
|
| 53 |
-
std::unordered_map<std::string, size_t> index_;
|
| 54 |
-
mutable std::mutex mutex_;
|
| 55 |
-
};
|
| 56 |
-
|
| 57 |
-
} // namespace autoforge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/src/dag_engine.cpp
DELETED
|
@@ -1,91 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* AutoForge DAG Engine — Implementation
|
| 3 |
-
*/
|
| 4 |
-
|
| 5 |
-
#include "dag_engine.h"
|
| 6 |
-
#include <algorithm>
|
| 7 |
-
#include <queue>
|
| 8 |
-
#include <unordered_set>
|
| 9 |
-
#include <iostream>
|
| 10 |
-
|
| 11 |
-
namespace autoforge {
|
| 12 |
-
|
| 13 |
-
DAGEngine::DAGEngine() = default;
|
| 14 |
-
DAGEngine::~DAGEngine() = default;
|
| 15 |
-
|
| 16 |
-
std::string DAGEngine::version() {
|
| 17 |
-
return "0.1.0";
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
void DAGEngine::add_node(const DAGNode& node) {
|
| 21 |
-
std::lock_guard<std::mutex> lock(mutex_);
|
| 22 |
-
index_[node.id] = nodes_.size();
|
| 23 |
-
nodes_.push_back(node);
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
size_t DAGEngine::node_count() const {
|
| 27 |
-
std::lock_guard<std::mutex> lock(mutex_);
|
| 28 |
-
return nodes_.size();
|
| 29 |
-
}
|
| 30 |
-
|
| 31 |
-
void DAGEngine::clear() {
|
| 32 |
-
std::lock_guard<std::mutex> lock(mutex_);
|
| 33 |
-
nodes_.clear();
|
| 34 |
-
index_.clear();
|
| 35 |
-
}
|
| 36 |
-
|
| 37 |
-
bool DAGEngine::validate() const {
|
| 38 |
-
std::lock_guard<std::mutex> lock(mutex_);
|
| 39 |
-
|
| 40 |
-
// Kahn's algorithm for cycle detection
|
| 41 |
-
std::unordered_map<std::string, int> in_degree;
|
| 42 |
-
for (const auto& node : nodes_) {
|
| 43 |
-
if (in_degree.find(node.id) == in_degree.end()) {
|
| 44 |
-
in_degree[node.id] = 0;
|
| 45 |
-
}
|
| 46 |
-
for (const auto& dep : node.deps) {
|
| 47 |
-
in_degree[node.id]++;
|
| 48 |
-
}
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
std::queue<std::string> ready;
|
| 52 |
-
for (const auto& [id, deg] : in_degree) {
|
| 53 |
-
if (deg == 0) {
|
| 54 |
-
ready.push(id);
|
| 55 |
-
}
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
size_t processed = 0;
|
| 59 |
-
while (!ready.empty()) {
|
| 60 |
-
auto current = ready.front();
|
| 61 |
-
ready.pop();
|
| 62 |
-
processed++;
|
| 63 |
-
|
| 64 |
-
// Find nodes that depend on current
|
| 65 |
-
for (const auto& node : nodes_) {
|
| 66 |
-
for (const auto& dep : node.deps) {
|
| 67 |
-
if (dep == current) {
|
| 68 |
-
in_degree[node.id]--;
|
| 69 |
-
if (in_degree[node.id] == 0) {
|
| 70 |
-
ready.push(node.id);
|
| 71 |
-
}
|
| 72 |
-
}
|
| 73 |
-
}
|
| 74 |
-
}
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
return processed == nodes_.size();
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
bool DAGEngine::execute() {
|
| 81 |
-
// Phase 2: actual concurrent task execution
|
| 82 |
-
if (!validate()) {
|
| 83 |
-
std::cerr << "[DAGEngine] Invalid DAG — contains cycles" << std::endl;
|
| 84 |
-
return false;
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
std::cout << "[DAGEngine] DAG validated. Execution not yet implemented (Phase 2)." << std::endl;
|
| 88 |
-
return true;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
} // namespace autoforge
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/src/main.cpp
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* AutoForge DAG Engine — Entry Point
|
| 3 |
-
*
|
| 4 |
-
* Proves the C++ project compiles and links.
|
| 5 |
-
*/
|
| 6 |
-
|
| 7 |
-
#include "dag_engine.h"
|
| 8 |
-
#include <iostream>
|
| 9 |
-
|
| 10 |
-
int main() {
|
| 11 |
-
std::cout << "========================================" << std::endl;
|
| 12 |
-
std::cout << " AutoForge DAG Engine v"
|
| 13 |
-
<< autoforge::DAGEngine::version() << std::endl;
|
| 14 |
-
std::cout << "========================================" << std::endl;
|
| 15 |
-
|
| 16 |
-
autoforge::DAGEngine engine;
|
| 17 |
-
|
| 18 |
-
// Add some demo nodes
|
| 19 |
-
engine.add_node({"plan", "Planning", "plan", {}});
|
| 20 |
-
engine.add_node({"code", "Code Generation", "code", {"plan"}});
|
| 21 |
-
engine.add_node({"test", "Test Generation", "test", {"plan"}});
|
| 22 |
-
engine.add_node({"analyze", "Static Analysis", "analyze", {"code"}});
|
| 23 |
-
engine.add_node({"run", "Execute Tests", "execute", {"code", "test"}});
|
| 24 |
-
|
| 25 |
-
std::cout << "Nodes: " << engine.node_count() << std::endl;
|
| 26 |
-
std::cout << "Valid: " << (engine.validate() ? "yes" : "no") << std::endl;
|
| 27 |
-
std::cout << std::endl;
|
| 28 |
-
|
| 29 |
-
engine.execute();
|
| 30 |
-
|
| 31 |
-
return 0;
|
| 32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpp/tests/test_dag.cpp
DELETED
|
@@ -1,75 +0,0 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* AutoForge DAG Engine — Basic Tests
|
| 3 |
-
*
|
| 4 |
-
* Minimal test suite without a framework — uses assert.
|
| 5 |
-
*/
|
| 6 |
-
|
| 7 |
-
#include "dag_engine.h"
|
| 8 |
-
#include <cassert>
|
| 9 |
-
#include <iostream>
|
| 10 |
-
|
| 11 |
-
void test_version() {
|
| 12 |
-
std::string ver = autoforge::DAGEngine::version();
|
| 13 |
-
assert(!ver.empty());
|
| 14 |
-
std::cout << "[PASS] version(): " << ver << std::endl;
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
void test_add_and_count() {
|
| 18 |
-
autoforge::DAGEngine engine;
|
| 19 |
-
assert(engine.node_count() == 0);
|
| 20 |
-
|
| 21 |
-
engine.add_node({"a", "Node A", "test", {}});
|
| 22 |
-
assert(engine.node_count() == 1);
|
| 23 |
-
|
| 24 |
-
engine.add_node({"b", "Node B", "test", {"a"}});
|
| 25 |
-
assert(engine.node_count() == 2);
|
| 26 |
-
|
| 27 |
-
std::cout << "[PASS] add_node / node_count" << std::endl;
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
void test_clear() {
|
| 31 |
-
autoforge::DAGEngine engine;
|
| 32 |
-
engine.add_node({"a", "Node A", "test", {}});
|
| 33 |
-
engine.add_node({"b", "Node B", "test", {}});
|
| 34 |
-
assert(engine.node_count() == 2);
|
| 35 |
-
|
| 36 |
-
engine.clear();
|
| 37 |
-
assert(engine.node_count() == 0);
|
| 38 |
-
|
| 39 |
-
std::cout << "[PASS] clear()" << std::endl;
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
void test_validate_acyclic() {
|
| 43 |
-
autoforge::DAGEngine engine;
|
| 44 |
-
engine.add_node({"a", "A", "test", {}});
|
| 45 |
-
engine.add_node({"b", "B", "test", {"a"}});
|
| 46 |
-
engine.add_node({"c", "C", "test", {"a", "b"}});
|
| 47 |
-
assert(engine.validate() == true);
|
| 48 |
-
|
| 49 |
-
std::cout << "[PASS] validate() — acyclic" << std::endl;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
void test_execute() {
|
| 53 |
-
autoforge::DAGEngine engine;
|
| 54 |
-
engine.add_node({"a", "A", "test", {}});
|
| 55 |
-
engine.add_node({"b", "B", "test", {"a"}});
|
| 56 |
-
assert(engine.execute() == true);
|
| 57 |
-
|
| 58 |
-
std::cout << "[PASS] execute()" << std::endl;
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
int main() {
|
| 62 |
-
std::cout << "==============================" << std::endl;
|
| 63 |
-
std::cout << " DAG Engine Tests" << std::endl;
|
| 64 |
-
std::cout << "==============================" << std::endl;
|
| 65 |
-
|
| 66 |
-
test_version();
|
| 67 |
-
test_add_and_count();
|
| 68 |
-
test_clear();
|
| 69 |
-
test_validate_acyclic();
|
| 70 |
-
test_execute();
|
| 71 |
-
|
| 72 |
-
std::cout << std::endl;
|
| 73 |
-
std::cout << "All tests passed!" << std::endl;
|
| 74 |
-
return 0;
|
| 75 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|