Skip to content

Commit

Permalink
Test decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
exAspArk committed Nov 5, 2024
1 parent ae9723d commit 4fc1fc2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ var TEST_PG_SCHEMA_COLUMNS = []PgSchemaColumn{
OrdinalPosition: "2",
},
{
ColumnName: "value",
ColumnName: "int_value",
UdtName: "int4",
IsNullable: "NO",
OrdinalPosition: "3",
},
{
ColumnName: "decimal_value",
UdtName: "numeric",
IsNullable: "NO",
OrdinalPosition: "4",
NumericPrecision: "10",
NumericScale: "2",
},
}

var TEST_LOADED_ROWS = [][]string{
{"1", "metric_1", "5"},
{"2", "metric_2", "10"},
{"3", "metric_1", "5"},
{"4", "metric_2", "10"},
{"5", "metric_1", "5"},
{"1", "metric_1", "5", "5.0"},
{"2", "metric_2", "10", "10.0"},
{"3", "metric_1", "5", "5.0"},
{"4", "metric_2", "10", "10.0"},
{"5", "metric_1", "5", "5.0"},
}

func init() {
Expand Down
4 changes: 4 additions & 0 deletions src/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ func TestHandleQuery(t *testing.T) {
"description": {"count"},
"values": {"5"},
},
"SELECT AVG(decimal_value) AS average FROM public.test_table": {
"description": {"average"},
"values": {"7"},
},
}

for query, responses := range responsesByQuery {
Expand Down

0 comments on commit 4fc1fc2

Please sign in to comment.