Skip to content

Add expression unit tests (62 tests)#33

Merged
poyrazK merged 2 commits intomainfrom
feat/expression-unit-tests
Apr 14, 2026
Merged

Add expression unit tests (62 tests)#33
poyrazK merged 2 commits intomainfrom
feat/expression-unit-tests

Conversation

@poyrazK
Copy link
Copy Markdown
Owner

@poyrazK poyrazK commented Apr 14, 2026

Summary

  • Created tests/expression_tests.cpp with 62 unit tests for parser/expression.cpp
  • Covers all expression types: BinaryExpr, UnaryExpr, ColumnExpr, ConstantExpr, ParameterExpr, FunctionExpr, InExpr, IsNullExpr

Test Coverage

  • BinaryExpr: arithmetic (+,-,*,/), comparisons (=,<>,<,<=,>,>=), logical (AND,OR)
  • UnaryExpr: negation (-), NOT
  • ColumnExpr: simple, qualified, not found, null tuple
  • ConstantExpr: int64, float64, text, bool, null
  • ParameterExpr: binding, null params
  • FunctionExpr: basic, distinct, multiple args
  • InExpr: IN, NOT IN
  • IsNullExpr: IS NULL, IS NOT NULL
  • Clone tests for all expression types
  • to_string tests for all expression types
  • Complex expressions (arithmetic and logical)
  • Expression type queries

Test Plan

  • All 30 tests pass (bloom_filter_tests excluded - pre-existing issue)
  • CI builds pass

Note

Division (/) always returns float64 per expression.cpp implementation

Summary by CodeRabbit

Release Notes

  • Tests
    • Added comprehensive test suite for expression evaluation and manipulation, covering binary operations, unary operations, column references, constants, parameters, functions, IN clauses, and NULL checking across multiple data types.

poyrazK and others added 2 commits April 14, 2026 19:12
Created tests/expression_tests.cpp covering:
- BinaryExpr: arithmetic (+,-,*,/), comparisons (=,<>,<,<=,>,>=), logical (AND,OR)
- UnaryExpr: negation (-), NOT
- ColumnExpr: simple, qualified, not found, null tuple
- ConstantExpr: int64, float64, text, bool, null
- ParameterExpr: binding, null params
- FunctionExpr: basic, distinct, multiple args
- InExpr: IN, NOT IN
- IsNullExpr: IS NULL, IS NOT NULL
- Clone tests for all expression types
- to_string tests for all expression types
- Complex expressions (arithmetic and logical)
- Expression type queries

Note: Division (/) always returns float64 per expression.cpp implementation
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc255da3-b4f3-49e0-923a-9782aec08d6c

📥 Commits

Reviewing files that changed from the base of the PR and between d1294e9 and 00ce42c.

📒 Files selected for processing (2)
  • CMakeLists.txt
  • tests/expression_tests.cpp

📝 Walkthrough

Walkthrough

This pull request adds comprehensive unit test coverage for the expression subsystem. A new test file with 40+ GoogleTest cases is introduced alongside a CMake configuration update to register the new test executable.

Changes

Cohort / File(s) Summary
Test Configuration
CMakeLists.txt
Added registration of expression_tests executable to the CMake build system via add_cloudsql_test macro.
Expression Tests
tests/expression_tests.cpp
New comprehensive test file covering expression evaluation and stringification for binary operators (arithmetic, comparison, logical), unary operators, column references, constants, parameters, functions, IN/NOT IN, and IS NULL expressions. Includes clone behavior and type getter verification.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Poem

🐰 With whiskers twitching, tests now gleam,
Expression nodes fulfill the dream!
FROM constants, operators, and functions too,
Our warren's code is stronger—tried and true!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/expression-unit-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@poyrazK poyrazK merged commit 7a91cee into main Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant