Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
45fa99d
Create mini-converter
Hasanstayn Mar 27, 2026
6b0ae78
Delete problems/mini-converter
Hasanstayn Mar 27, 2026
d841ebe
mini-converter SPEC ve kodları eklendi
Hasanstayn Mar 27, 2026
8d81af5
Create solution_v0
Hasanstayn Mar 27, 2026
b8bc393
Add project specifications for mini-converter
Hasanstayn Mar 27, 2026
b74ec88
Rename solution_v0 to solution_v0.py
Hasanstayn Mar 27, 2026
8931544
Add tests for mini-converter commands and functionality
Hasanstayn Mar 27, 2026
d124ae6
Implement mini-converter with initialization and conversion
Hasanstayn Mar 27, 2026
626c72f
Add test specification for mini-converter
Hasanstayn Mar 27, 2026
c574a12
Rename test_spec_v0.py to test_v0.py
Hasanstayn Mar 27, 2026
2cc7fe4
Implement tests for mini-converter v1
Hasanstayn Mar 27, 2026
749ad48
Add README.md for mini-converter project
Hasanstayn Mar 27, 2026
3196594
Rename SPEC_v0.txt to SPEC-v1.txt
Hasanstayn Mar 29, 2026
1437740
Rename SPEC_v1.txt to SPEC-v2.txt
Hasanstayn Mar 29, 2026
66819f6
Add solution-v1.py for mini converter
Hasanstayn Mar 29, 2026
3c7521b
Add solution-v2.py for mini converter
Hasanstayn Mar 29, 2026
f0b0030
Add problem.json for Mini-Converter specifications
Hasanstayn Mar 29, 2026
c6b53d0
Add test_v1.sh for mini-converter
Hasanstayn Mar 29, 2026
5cb4d88
Update and rename test_v1.py to test-v2.sh
Hasanstayn Mar 29, 2026
24fe418
Rename test_v1.sh to test-v1.sh
Hasanstayn Mar 29, 2026
78f6cf6
Rename solution-v1.py to solution_v0.py
Hasanstayn Mar 29, 2026
120096b
Rename solution-v2.py to solution_v1.py
Hasanstayn Mar 29, 2026
17b0462
Delete solution_v0.py
Hasanstayn Mar 31, 2026
e475b92
Update SPEC-v2.txt
Hasanstayn Mar 31, 2026
17207bb
Create miniconverter
Hasanstayn Apr 16, 2026
8d3b8fd
Delete problems/miniconverter
Hasanstayn Apr 16, 2026
5d99331
Delete problems/mini-converter directory
Hasanstayn Apr 16, 2026
b2b2aba
Create miniconverter
Hasanstayn Apr 16, 2026
4f86966
Delete problems/miniconverter
Hasanstayn Apr 16, 2026
aef11d8
Add problem.json for MiniConverter specifications
Hasanstayn Apr 16, 2026
5fe8283
Add files via upload
Hasanstayn Apr 16, 2026
ec520ef
Merge branch 'seyyah:main' into main
Hasanstayn Apr 16, 2026
a844482
Add files via upload
Hasanstayn Apr 16, 2026
d7ed47f
v2 update
Hasanstayn Apr 16, 2026
893ab05
Delete problems/miniconverter/SPEC-v3.txt
Hasanstayn Apr 16, 2026
85f6188
Delete problems/miniconverter/solution_v2.py
Hasanstayn Apr 16, 2026
7247517
Delete problems/miniconverter/solution_v1.py
Hasanstayn Apr 16, 2026
a64f94a
Delete problems/miniconverter/solution_v0.py
Hasanstayn Apr 16, 2026
b32d948
Add type and language to miniconverter problem
Hasanstayn Apr 16, 2026
d5e2aac
test
Hasanstayn Apr 18, 2026
465c8e0
Delete problems/miniconverter/README.md
Hasanstayn Apr 21, 2026
744a75f
Delete artifacts/gemini/gemini-3.1-flash-lite-preview/miniconverter d…
Hasanstayn Apr 21, 2026
68489b1
Merge branch 'seyyah:main' into main
Hasanstayn Apr 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions problems/miniconverter/SPEC-v0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
PROJECT: miniconverter
AUTHOR: HASAN YILMAZ (250708022)
VERSION: v0
DATE: 2026-03-15

========================================
OVERVIEW
========================================
mini-converter is a CLI tool for length unit conversions.
Supported units: meters (m), kilometers (km), centimeters (cm), millimeters (mm).
All data is stored in a directory called .miniconv/ in the current directory.

========================================
COMMANDS
========================================

--- init ---
Usage: python miniconverter.py init
Behavior: Creates .miniconv/ directory and history.dat file.
Output: "Conversion storage initialized." or "Already initialized."

--- convert ---
Usage: python miniconverter.py convert <value> <from_unit> <to_unit>
Behavior: Converts the value and logs it to .miniconv/history.dat.
Output: "<value> <from_unit> is <result> <to_unit>"

--- history ---
Usage: python miniconverter.py history
Output: "Command 'history' will be implemented in future weeks."

--- stats ---
Usage: python miniconverter.py stats
Output: "Command 'stats' will be implemented in future weeks."

========================================
DATA FORMAT
========================================
File: .miniconv/history.dat
Format: value|from_unit|to_unit|result|date
Example: 10.0|m|cm|1000.0|2026-03-13

========================================
ERROR HANDLING
========================================
- Run before init: "Error: Not initialized. Run: python miniconverter.py init"
- Unsupported unit: "Error: Unsupported unit <unit>. Use m, km, cm, or mm."
- Missing arguments: "Usage: python miniconverter.py <command> [args]"
- Unknown command: "Unknown command: <command>"
66 changes: 66 additions & 0 deletions problems/miniconverter/SPEC-v1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
PROJECT: miniconverter
AUTHOR: HASAN YILMAZ (250708022)
VERSION: V1
DATE: 2026-03-27


========================================
OVERVIEW
========================================
mini-converter is a CLI tool for length unit conversions.
Supported units: meters (m), kilometers (km), centimeters (cm), millimeters (mm).
All data is stored in a directory called .miniconv/ in the current directory.


========================================
COMMANDS
========================================

--- init ---
Usage: python miniconverter.py init
Behavior: Creates .miniconv/ directory and history.dat file.
Output: "Conversion storage initialized." or "Already initialized."

--- convert ---
Usage: python miniconverter.py convert <value> <from_unit> <to_unit>
Behavior: Converts the value and logs it to .miniconv/history.dat.

[V2 ENHANCEMENTS]:
- Case Insensitivity: Unit inputs (m, km, cm, mm) are accepted regardless of case (e.g., KM, m, Cm are all valid).
- Decimal Precision: Input values and results support decimal numbers and are processed with 2-decimal precision (e.g., 1.234 m is calculated as 123.40 cm).

Output: "<value> <from_unit> is <result> <to_unit>"

--- history ---
Usage: python miniconverter.py history
Output: "Command 'history' will be implemented in future weeks."

--- stats ---
Usage: python miniconverter.py stats
Output: "Command 'stats' will be implemented in future weeks."


========================================
V1 CHANGE LOG
========================================
1. Added full support for mixed-case unit strings (Case Insensitivity).
2. Implemented 2-decimal place precision for all numeric calculations.
3. Maintained backward compatibility with v0 file structures and commands.
4. Updated error messages to provide better guidance for input units.


========================================
DATA FORMAT
========================================
File: .miniconv/history.dat
Format: value|from_unit|to_unit|result|date
Example: 10.0|m|cm|1000.00|2026-03-27


========================================
ERROR HANDLING
========================================
- Run before init: "Error: Not initialized. Run: python miniconverter.py init"
- Unsupported unit: "Error: Unsupported unit <unit>. Use m, km, cm, or mm."
- Missing arguments: "Usage: python miniconverter.py <command> [args]"
- Unknown command: "Unknown command: <command>"
68 changes: 68 additions & 0 deletions problems/miniconverter/SPEC-v2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
PROJECT: miniconverter
AUTHOR: HASAN YILMAZ (250708022)
VERSION: V2
DATE: 2026-04-16

========================================
OVERVIEW
========================================
miniconverter is a CLI tool for length unit conversions.
Supported units: meters (m), kilometers (km), centimeters (cm), millimeters (mm).
All data is stored in a directory called .miniconv/ in the current directory.

========================================
COMMANDS
========================================

--- init ---
Usage: python miniconverter.py init
Behavior: Creates .miniconv/ directory and history.dat file.
Output: "Conversion storage initialized." or "Already initialized."

--- convert ---
Usage: python miniconverter.py convert <value> <from_unit> <to_unit>
Behavior: Converts the value and logs it to .miniconv/history.dat.

[V1 ENHANCEMENTS]:
- Case Insensitivity: Unit inputs (m, km, cm, mm) are accepted regardless of case.
- Decimal Precision: Input values and results support decimal numbers.

[V2 ENHANCEMENTS]:
- Value Validation: The system checks if the input <value> is a valid number before processing to prevent crashes.
- Command Handling: The program identifies and reports unknown commands instead of failing silently.
- Output & Log Consistency: Standardizes 2-decimal format across all terminal outputs and history.dat entries.

Output: "<value> <from_unit> is <result> <to_unit>"

--- history ---
Usage: python miniconverter.py history
Output: "Command 'history' will be implemented in future weeks."

--- stats ---
Usage: python miniconverter.py stats
Output: "Command 'stats' will be implemented in future weeks."

========================================
V2 CHANGE LOG
========================================
1. Added full support for mixed-case unit strings (Inherited from V1).
2. Implemented 2-decimal place precision for all numeric calculations (Inherited from V1).
3. Added strict validation to catch non-numeric inputs for the <value> argument.
4. Implemented explicit error messages for unknown CLI commands (e.g., Unknown command: <command>).
5. Standardized output and log file formatting for better data consistency.

========================================
DATA FORMAT
========================================
File: .miniconv/history.dat
Format: value|from_unit|to_unit|result|date
Example: 10.0|m|cm|1000.00|2026-04-16

========================================
ERROR HANDLING
========================================
- Run before init: "Error: Not initialized. Run: python miniconverter.py init"
- Unsupported unit: "Error: Unsupported unit <unit>. Use m, km, cm, or mm."
- Invalid Value: "Error: <value> is not a valid number."
- Unknown command: "Unknown command: <command>"
- Missing arguments: "Usage: python miniconverter.py <command> [args]"
16 changes: 16 additions & 0 deletions problems/miniconverter/problem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "miniconverter",
"type": "cli",
"language": "python",
"adapter": "cli",
"binary_name": "solution_v2.py",
"v0_spec": "SPEC-v0.txt",
"v0_test": "test-v0.sh",
"v0_prompt": "Implement {{binary_name}} as described in SPEC-v0.txt using Python. The program must support 'init' and 'convert' commands. Verify your implementation passes all tests by running: bash test-v0.sh",
"v1_spec": "SPEC-v1.txt",
"v1_test": "test-v1.sh",
"v1_prompt": "Read SPEC-v1.txt and extend the existing {{binary_name}} implementation with case-insensitivity and decimal precision as described in SPEC-v1.txt. Verify your implementation passes all tests by running: bash test-v1.sh",
"v2_spec": "SPEC-v2.txt",
"v2_test": "test-v2.sh",
"v2_prompt": "Read SPEC-v2.txt and extend the existing {{binary_name}} implementation with non-numeric value validation as described in SPEC-v2.txt. Verify your implementation passes all tests by running: bash test-v2.sh"
}
131 changes: 131 additions & 0 deletions problems/miniconverter/test-v0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
#!/usr/bin/env bash
# mini-converter v0 Bash Test Script
# Ogrenci: HASAN YILMAZ 250708022
set -e

PASS_COUNT=0
FAIL_COUNT=0

#
fail() {
echo "FAIL: $1"
FAIL_COUNT=$((FAIL_COUNT+1))
}

pass() {
echo "PASS: $1"
PASS_COUNT=$((PASS_COUNT+1))
}

cleanup() {
# Her testten once klasoru temizle
rm -rf .miniconv
}

# Calistirilacak ana komut
BIN="python3 solution_v0.py"

######################################
# Setup
######################################
cleanup

######################################
# Test 1: init creates directory
######################################
if $BIN init > /dev/null && [ -d .miniconv ]; then
pass "init creates .miniconv directory"
else
fail "init creates .miniconv directory"
fi

######################################
# Test 2: init already exists
######################################
if $BIN init | grep -q "Already initialized"; then
pass "init already exists prints correct message"
else
fail "init already exists prints correct message"
fi

######################################
# Test 3: convert m to cm
######################################
if $BIN convert 1 m cm | grep -q "1.0 m is 100.0 cm"; then
pass "convert 1 m to cm works"
else
fail "convert 1 m to cm works"
fi

######################################
# Test 4: convert km to m
######################################
if $BIN convert 2 km m | grep -q "2000.0 m"; then
pass "convert 2 km to m works"
else
fail "convert 2 km to m works"
fi

######################################
# Test 5: unsupported unit
######################################
if $BIN convert 5 m mile | grep -q "Error"; then
pass "unsupported unit returns Error"
else
fail "unsupported unit returns Error"
fi

######################################
# Test 6: future weeks commands (history/stats)
######################################
if $BIN history | grep -q "future weeks" && $BIN stats | grep -q "future weeks"; then
pass "history/stats show future weeks message"
else
fail "history/stats show future weeks message"
fi

######################################
# Test 7: error no init
######################################
cleanup
if $BIN convert 1 m cm | grep -q "Not initialized"; then
pass "error when running convert without init"
else
fail "error when running convert without init"
fi

######################################
# Test 8: unknown command
######################################
$BIN init > /dev/null
if $BIN reset | grep -q "Unknown command"; then
pass "unknown command returns correct message"
else
fail "unknown command returns correct message"
fi

######################################
# Test 9: missing arguments
######################################
if $BIN convert 10 m | grep -q "Usage"; then
pass "missing arguments shows Usage message"
else
fail "missing arguments shows Usage message"
fi

######################################
# Summary
######################################
echo ""
echo "========================"
echo "PASSED: $PASS_COUNT"
echo "FAILED: $FAIL_COUNT"
echo "TOTAL: $((PASS_COUNT + FAIL_COUNT))"
echo "========================"

if [ "$FAIL_COUNT" -eq 0 ]; then
echo "ALL V1 TESTS PASSED"
exit 0
else
exit 1
fi
Loading