harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-3257harbor download openthoughts/tasktrove-exp-rpt-issue-issue-3257Self-contained coding task: Implement a 2D Position class with deterministic tests and a minimal build/test harness
What this feature request asks for
Position2D.What you need to implement (files to create/modify in /app/)
The task is to implement the full, working library and tests as described; you should not rely on any existing project code. The before-state shown below is intentionally minimal scaffolding to illustrate the patch context.
Code blocks show a minimal, incomplete starting point. You are expected to replace these with a complete, working implementation.
// Position2D.h (before)
#ifndef POSITION2D_H
#define POSITION2D_H
class Position2D {
public:
Position2D();
Position2D(double x, double y);
// TODO: full API to be implemented
};
#endif // POSITION2D_H
// Position2D.cpp (before)
#include "Position2D.h"
Position2D::Position2D() : x(0.0), y(0.0) {}
Position2D::Position2D(double x_, double y_) : x(x_), y(y_) {}
// test_driver.cpp (before)
#include <iostream>
int main() {
std::cout << "Placeholder test driver. Implement deterministic tests here." << std::endl;
return 0;
}
# Makefile (before)
all:
\t@echo "Nothing built yet. Implement library and test here."
# bench.sh (before)
#!/bin/bash
echo "Bench script placeholder. Implement timing collection here."
Position2D.h should declare a compact, self-contained 2D point/vector type with a subset of operations, including:
Position2D.cpp should implement all the declared methods with simple, realistic logic (no external dependencies). Use double precision. Be mindful of edge cases (e.g., normalization of zero-length vector).
test_driver.cpp should deterministically exercise the class, printing lines that start with PASS: or FAIL: for checks such as:
Makefile should:
bench.sh should:
verify.sh (optional) should:
All code should be standard C++ (C++11/14/17 compatible). No external dependencies beyond the standard library.
How to run:
You are not shown the internal patch content here. The task is to implement the feature as described from scratch in /app/. The focus is on delivering a fully working, self-contained library plus deterministic tests and a small benchmarking harness.