Skip to content

fix: DatetimeChunkDecoder bug fix + test coverage ~98%#60

Merged
afonsoft merged 1 commit into
mainfrom
devin/1777916817-fix-tests-increase-coverage
May 4, 2026
Merged

fix: DatetimeChunkDecoder bug fix + test coverage ~98%#60
afonsoft merged 1 commit into
mainfrom
devin/1777916817-fix-tests-increase-coverage

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Resumo / Summary

🐛 Bug Fix: DatetimeChunkDecoder

Correção de ArgumentOutOfRangeException no DatetimeChunkDecoder (tanto Metar quanto Taf) quando o dia do relatório excede os dias do mês resolvido após rollback de mês.

Exemplo: Dia 31 em maio (dia atual = 4) → rollback para abril (30 dias) → crash ao criar DateTime(2026, 4, 31, ...).

Solução: Clamping do dia ao máximo de dias do mês resolvido + uso de DateTime.UtcNow para consistência.

🧪 Novos Testes (+67 testes, 354 → 421 total)

Classe Antes Depois
PresentWeather 0% 100%
MetarChunkDecoderException 53.5% 82.1%
TafChunkDecoderException 32.1% 82.1%
Value (Metar) 98.4% 100%
Value (Taf) 98.4% 100%
ForecastPeriod 90.9% 100%
TafChunkDecoder 90.4% 100%
DecodedMetar 100% 100%

📊 Cobertura Geral

Métrica Antes Depois
Line coverage 94.8% 97.8%
Branch coverage 92.3% 94.7%
Method coverage 93.8% 98.6%

📝 Documentação

  • README.md atualizado com novidades e estrutura de testes
  • CHANGELOG.md atualizado com detalhes da versão

Link to Devin session: https://app.devin.ai/sessions/4bcf653aff664bf3bd2d6a36f02e48e6
Requested by: @afonsoft

…o ~98%

- Fix ArgumentOutOfRangeException in DatetimeChunkDecoder when day exceeds
  days in resolved month (e.g., day 31 in April after month rollback)
- Use DateTime.UtcNow instead of DateTime.Now for consistency
- Add 67 new tests (354 → 421 total), all passing
- Line coverage: 94.8% → 97.8%
- Branch coverage: 92.3% → 94.7%
- Method coverage: 93.8% → 98.6%

New test files:
- PresentWeatherTest (0% → 100%)
- MetarExceptionExtendedTest (53.5% → 82.1%)
- TafExceptionExtendedTest (32.1% → 82.1%)
- ValueExtendedTest for Metar and Taf (98.4% → 100%)
- ForecastPeriodTest (90.9% → 100%)
- DecodedMetarExtendedTest
- TafChunkDecoderBaseTest (90.4% → 100%)

Updated README.md and CHANGELOG.md with coverage improvements.

Co-Authored-By: Afonso Dutra Nogueira Filho <afonsoft@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@afonsoft
Copy link
Copy Markdown
Owner

afonsoft commented May 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
🔚 Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 4, 2026

@afonsoft afonsoft merged commit af504c8 into main May 4, 2026
13 of 15 checks passed
{
var result = Value.ToInt("1234");
ClassicAssert.IsNotNull(result);
ClassicAssert.AreEqual(1234, result.Value);
{
var result = Value.ToInt("M05");
ClassicAssert.IsNotNull(result);
ClassicAssert.AreEqual(-5, result.Value);
{
var result = Value.ToInt("P10");
ClassicAssert.IsNotNull(result);
ClassicAssert.AreEqual(10, result.Value);
{
var result = Value.ToInt("1234");
ClassicAssert.IsNotNull(result);
ClassicAssert.AreEqual(1234, result.Value);
{
var result = Value.ToInt("M05");
ClassicAssert.IsNotNull(result);
ClassicAssert.AreEqual(-5, result.Value);
{
var result = Value.ToInt("P10");
ClassicAssert.IsNotNull(result);
ClassicAssert.AreEqual(10, result.Value);
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.

2 participants