diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..b261b78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. Windows] + - Version [e.g. 1.0.0] + +**Additional content** +Add any other informations about the problem you think might be helpful. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..a2e91dc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,23 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: feature request +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Add a real world example (Optionaly)** +Some code that describe the use of this feature in a real world situation + +**Additional context** +Add any other context or screenshots about the feature request here that might be helpful. diff --git a/interpreter/eclaType/float.go b/interpreter/eclaType/float.go index 912a052..5ef53c0 100644 --- a/interpreter/eclaType/float.go +++ b/interpreter/eclaType/float.go @@ -29,12 +29,12 @@ func (f Float) SetValue(value any) error { } func (f Float) String() string { - return fmt.Sprintf("%f", f) + return fmt.Sprintf("%g", f) } // GetString returns the string representation of the float func (f Float) GetString() String { - return String(fmt.Sprint(f)) + return String(f.String()) } // GetType returns the type Float diff --git a/interpreter/eclaType/float_test.go b/interpreter/eclaType/float_test.go index ba85961..82c1708 100644 --- a/interpreter/eclaType/float_test.go +++ b/interpreter/eclaType/float_test.go @@ -284,11 +284,11 @@ func TestAddFloatString(t *testing.T) { if err != nil { t.Error(err) } - expect1, _ := strconv.ParseFloat("3.14", 32) - Newexpect1 := fmt.Sprintf("%6f", expect1) + Newexpect1 := fmt.Sprintf("%g", 3.14) expect2 := "hello" expect := Newexpect1 + expect2 expected := String(expect) + fmt.Println(expected) if result.GetValue() != expected { t.Errorf("Expected %v, got %v", expected, result) } diff --git a/interpreter/eclaType/string_test.go b/interpreter/eclaType/string_test.go index ccc9307..930cf34 100644 --- a/interpreter/eclaType/string_test.go +++ b/interpreter/eclaType/string_test.go @@ -2,7 +2,6 @@ package eclaType import ( "fmt" - "strconv" "testing" ) @@ -59,8 +58,7 @@ func TestAddStringFloat(t *testing.T) { if err != nil { t.Error(err) } - expect1, _ := strconv.ParseFloat("1.1", 32) - Newexpect1 := fmt.Sprintf("%6f", expect1) + Newexpect1 := fmt.Sprintf("%g", 1.1) expect2 := "Hello" expect := expect2 + Newexpect1 expected := String(expect)