Skip to content

Conversation

@adcondev
Copy link
Owner

🎯 What: The testing gap addressed is the lack of unit tests for the internal/calculate package, specifically for DotsPerLine, MmToDots, and DotsToMm functions.
📊 Coverage: The tests now cover standard scenarios (e.g., 80mm/58mm paper at 203 DPI), zero values, negative inputs (where applicable), and edge cases like zero DPI.
Result: The improvement in test coverage ensures the accuracy of these fundamental unit conversion utilities and prevents regressions.


PR created automatically by Jules for task 1365553061994360617 started by @adcondev

Add table-driven tests for DotsPerLine, MmToDots, and DotsToMm functions in the internal/calculate package.

Tests cover:
- Standard paper widths (80mm, 58mm) and DPIs (203, 180).
- Zero width/dots/mm scenarios.
- Negative input handling.
- Edge cases like zero DPI (verifying behavior).

This ensures the accuracy of fundamental unit conversions used throughout the library.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions
Copy link
Contributor

👋 Thanks for opening this PR, @adcondev!

Here's what will happen next:

  • 🤖 Automated checks will run
  • 🏷️ Labels will be added automatically
  • 👀 A maintainer will review your changes

Please make sure:

  • ✅ All tests pass
  • 📝 The PR title follows conventional commits
  • 📋 The PR template is filled out completely

@github-actions
Copy link
Contributor

⚡ Benchmark Results

📈 Performance Comparison

📊 Click to expand detailed results

Current Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3118 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3671428	       330.4 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  415224	      2721 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  537505	      2056 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  490345	      2343 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   95006	     12509 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  415986	      2704 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  280921	      4141 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  525998	      2112 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  246051	      4738 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 8791554	       135.1 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6716810	       178.2 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	368429950	         3.258 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	31882032	        39.31 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14421495	        83.30 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  497493	      2392 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  139507	      8474 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     614	   1879542 ns/op	 3469937 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     332	   3628723 ns/op	 5481096 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     139	   8382857 ns/op	 5235268 B/op	  230723 allocs/op

Base Branch Results

BenchmarkNewDocument-4    	1000000000	         0.3120 ns/op	       0 B/op	       0 allocs/op
BenchmarkBuildSimple-4    	 3682395	       326.0 ns/op	     240 B/op	       4 allocs/op
BenchmarkBuildComplex-4   	  412598	      2708 ns/op	    1809 B/op	      25 allocs/op
BenchmarkToJSON-4         	  543272	      2066 ns/op	     592 B/op	       3 allocs/op
BenchmarkParseDocument_Minimal-4    	  512464	      2304 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Receipt-4    	   94244	     12614 ns/op	    2392 B/op	      34 allocs/op
BenchmarkCommandUnmarshal_Text-4    	  420345	      2743 ns/op	     568 B/op	      19 allocs/op
BenchmarkCommandUnmarshal_Table-4   	  279891	      4161 ns/op	     944 B/op	      21 allocs/op
BenchmarkTextCommandParsing-4       	  529851	      2111 ns/op	     544 B/op	      16 allocs/op
BenchmarkTableCommandParsing-4      	  244364	      4751 ns/op	    1000 B/op	      29 allocs/op
BenchmarkParseHexString-4           	 7226667	       160.9 ns/op	      48 B/op	       2 allocs/op
BenchmarkCleanHexString-4           	 6518689	       183.3 ns/op	      64 B/op	       2 allocs/op
BenchmarkContainsSequence-4         	295388701	         4.056 ns/op	       0 B/op	       0 allocs/op
BenchmarkCheckCriticalCommands-4    	32804752	        35.66 ns/op	       0 B/op	       0 allocs/op
BenchmarkDocument_Validate-4       	14523273	        83.48 ns/op	       0 B/op	       0 allocs/op
BenchmarkParseDocument_Simple-4    	  499491	      2381 ns/op	     568 B/op	      14 allocs/op
BenchmarkParseDocument_Complex-4   	  137887	      8469 ns/op	    1352 B/op	      26 allocs/op
BenchmarkPrintImage_Small-4             	     600	   1931674 ns/op	 3469939 B/op	      24 allocs/op
BenchmarkPrintImage_Medium-4            	     328	   3702212 ns/op	 5481087 B/op	      24 allocs/op
BenchmarkPrintImage_ThermalPreview-4    	     141	   8511979 ns/op	 5231178 B/op	  230423 allocs/op

💡 Note: Use benchstat for statistical comparison

🎯 Summary

  • Total Benchmarks: 32
  • Average Speed: 2565240 ns/op
  • Average Memory: 2396936 B/op
  • Average Allocations: 41093 allocs/op

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant