Skip to content

add BAHTTEXT and DOLLAR with their test files #2148

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhuyanhuazhuyanhua
Copy link

@zhuyanhuazhuyanhua zhuyanhuazhuyanhua commented May 28, 2025

PR Details

Description

Related Issue

Motivation and Context

How Has This Been Tested

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@xuri xuri added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 29, 2025
@xuri xuri requested a review from Copilot May 29, 2025 06:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds Thai baht text conversion and broadens DOLLAR formatting tests across cultures

  • Implements BAHTTEXT logic and Thai digit/unit mappings in calc.go
  • Adds TestBAHTTEXT and TestDOLLAR in calc_test.go covering zero, integer, decimal, large values, and multi‐culture scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
calc.go Implemented numToThaiText, Thai digit/unit maps, and BAHTTEXT function
calc_test.go Imported fmt; added TestBAHTTEXT and TestDOLLAR test suites
Comments suppressed due to low confidence (1)

calc.go:18905

  • Consider adding a test case for inputs with more than two decimal places (e.g., 1.234) to verify intended rounding vs. truncation behavior.
decimalPart := int((num.Number - float64(integerPart)) * 100)

// 定义错误信息变量
const (
errNoArgMsg = "BAHTTEXT requires at least 1 argument"
errTooManyArgs = "BAHTTEXT requires 1 argument"
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'too many args' error message is ambiguous. Consider changing it to "BAHTTEXT requires exactly 1 argument" for clarity.

Copilot uses AI. Check for mistakes.

zeroBahtMsg = "ศูนย์บาทถ้วน"
)

// 转换整数部分为泰语文本
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Duplicate comment found; you can remove the redundant line to keep comments concise.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants