-
-
Notifications
You must be signed in to change notification settings - Fork 14
Applying tdd on select-only exercise #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
91e48a5
* proof of concept
jimmytty 1c3d67f
Generate textual results
blackk-foxx 93bc000
Move each SELECT to separate file
blackk-foxx ac316d1
Revert "Move each SELECT to separate file"
blackk-foxx 581bda6
Evaluate results in python
blackk-foxx 20a91ec
Use less-challenging floating point values
blackk-foxx eac0195
Rework test structure
blackk-foxx 24d11d9
Remove unused file
blackk-foxx 2c68fb2
Rework test report logic
blackk-foxx 878a964
Make failure message more human-readable
blackk-foxx d1b773e
Really integrate with test runner
blackk-foxx 6303fbe
Apply suggestions from code review
blackk-foxx 284fe3a
Bug fix: rebind updated entry
blackk-foxx 54a1dde
Apply suggestions from code review
blackk-foxx 4afcf77
Appy review feedback
blackk-foxx b8c6850
Apply review comments
blackk-foxx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| DROP TABLE IF EXISTS weather_readings; | ||
| CREATE TABLE weather_readings ( | ||
| date TEXT NOT NULL, | ||
| location TEXT NOT NULL, | ||
| temperature REAL NOT NULL, | ||
| humidity INTEGER NOT NULL | ||
| ); | ||
|
|
||
| .mode csv | ||
| .import ./data.csv weather_readings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| "2025-10-22","Portland",53.1,72 | ||
| "2025-10-22","Seattle",56.2,66 | ||
| "2025-10-22","Boise",60.4,55 | ||
| "2025-10-23","Portland",54.6,70 | ||
| "2025-10-23","Seattle",57.8,68 | ||
| "2025-10-23","Boise",62.0,58 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| .print "All data" | ||
| .print "========" | ||
| SELECT * FROM weather_readings; | ||
|
|
||
| .print "Location and temperature only" | ||
| .print "=============================" | ||
| SELECT location, temperature FROM weather_readings; | ||
|
|
||
| .print "Greeting" | ||
| .print "========" | ||
| -- This one will fail on purpose | ||
| SELECT 'Hello, world.' AS say_hi; | ||
|
|
||
| .print "Data for Seattle" | ||
| .print "================" | ||
| SELECT * FROM weather_readings WHERE location = 'Seattle'; | ||
|
|
||
| .print "Data with humidity constraints" | ||
| .print "==============================" | ||
| SELECT * FROM weather_readings WHERE humidity BETWEEN 60 AND 70; | ||
|
|
||
| .print "Locations" | ||
| .print "=========" | ||
| SELECT location FROM weather_readings; | ||
|
|
||
| .print "Unique locations" | ||
| .print "================" | ||
| SELECT DISTINCT location FROM weather_readings; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| .print "All data" | ||
| .print "========" | ||
| SELECT * FROM weather_readings; | ||
|
|
||
| .print "Location and temperature only" | ||
| .print "=============================" | ||
| SELECT location, temperature FROM weather_readings; | ||
|
|
||
| .print "Greeting" | ||
| .print "========" | ||
| SELECT 'Hello, world.'; | ||
|
|
||
| .print "Data for Seattle" | ||
| .print "================" | ||
| SELECT * FROM weather_readings WHERE location = 'Seattle'; | ||
|
|
||
| .print "Data with humidity constraints" | ||
| .print "==============================" | ||
| SELECT * FROM weather_readings WHERE humidity BETWEEN 60 AND 70; | ||
|
|
||
| .print "Locations" | ||
| .print "=========" | ||
| SELECT location FROM weather_readings; | ||
|
|
||
| .print "Unique locations" | ||
| .print "================" | ||
| SELECT DISTINCT location FROM weather_readings; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| -- Create database: | ||
| .read ./create_fixture.sql | ||
|
|
||
| .mode columns | ||
|
|
||
| -- Generate expected output | ||
| .output expected_output.txt | ||
| .read ./intro-select_exemplar.sql | ||
|
|
||
| -- Run user solution | ||
| .output user_output.txt | ||
| .read ./intro-select.sql | ||
|
|
||
| -- Compare expected vs actual | ||
| .shell diff expected_output.txt user_output.txt | ||
blackk-foxx marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.