unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master c48e539 2/2: Use the expression angle units while simplifying it
       [not found] ` <20170518054757.B498920AC9@vcs0.savannah.gnu.org>
@ 2017-05-25 21:42   ` Ken Brown
  2017-05-26  2:03     ` Tino Calancha
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Brown @ 2017-05-25 21:42 UTC (permalink / raw)
  To: emacs-devel, Tino Calancha

On 5/18/2017 1:47 AM, Tino Calancha wrote:
> --- a/test/lisp/calc/calc-tests.el
> +++ b/test/lisp/calc/calc-tests.el
> @@ -86,6 +86,50 @@ An existing calc stack is reused, otherwise a new one is created."
>   					       (math-read-expr "1m") "cm")
>   			    '(* -100 (var cm var-cm)))))
>   
> +(ert-deftest test-calc-23889 ()
> +  "Test forhttp://debbugs.gnu.org/23889  and 25652."
> +  (dolist (mode '(deg rad))
> +    (let ((calc-angle-mode mode))
> +      ;; If user inputs angle units, then should ignore `calc-angle-mode'.
> +      (should (string= "5253"
> +                       (substring
> +                        (number-to-string
> +                         (nth 1
> +                              (math-simplify-units
> +                               '(calcFunc-cos (* 45 (var rad var-rad))))))
> +                        0 4)))

This can fail on some platforms, depending on the size of a Lisp 
integer, because

(nth 1
      (math-simplify-units
       '(calcFunc-cos (* 45 (var rad var-rad)))))

doesn't necessarily evaluate to an integer.  For example, on 32-bit 
Cygwin it evaluates to (bigpos 8818 2198 5253).  This causes the test to 
fail as follows:

$ make -C test calc-tests SELECTOR='\"test-calc-23889$$\"'
[...]
Test test-calc-23889 condition:
     (wrong-type-argument numberp
                          (bigpos 8818 2198 5253))
    FAILED  1/1  test-calc-23889

Ken



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Emacs-diffs] master c48e539 2/2: Use the expression angle units while simplifying it
  2017-05-25 21:42   ` [Emacs-diffs] master c48e539 2/2: Use the expression angle units while simplifying it Ken Brown
@ 2017-05-26  2:03     ` Tino Calancha
  0 siblings, 0 replies; 2+ messages in thread
From: Tino Calancha @ 2017-05-26  2:03 UTC (permalink / raw)
  To: Ken Brown; +Cc: Tino Calancha, Emacs developers



On Thu, 25 May 2017, Ken Brown wrote:

> On 5/18/2017 1:47 AM, Tino Calancha wrote:
>> --- a/test/lisp/calc/calc-tests.el
>> +++ b/test/lisp/calc/calc-tests.el
>> @@ -86,6 +86,50 @@ An existing calc stack is reused, otherwise a new one is 
>> created."
>>   					       (math-read-expr "1m") "cm")
>>   			    '(* -100 (var cm var-cm)))))
>>   +(ert-deftest test-calc-23889 ()
>> +  "Test forhttp://debbugs.gnu.org/23889  and 25652."
>> +  (dolist (mode '(deg rad))
>> +    (let ((calc-angle-mode mode))
>> +      ;; If user inputs angle units, then should ignore `calc-angle-mode'.
>> +      (should (string= "5253"
>> +                       (substring
>> +                        (number-to-string
>> +                         (nth 1
>> +                              (math-simplify-units
>> +                               '(calcFunc-cos (* 45 (var rad var-rad))))))
>> +                        0 4)))
>
> This can fail on some platforms, depending on the size of a Lisp integer, 
> because
>
> (nth 1
>     (math-simplify-units
>      '(calcFunc-cos (* 45 (var rad var-rad)))))
>
> doesn't necessarily evaluate to an integer.  For example, on 32-bit Cygwin it 
> evaluates to (bigpos 8818 2198 5253).  This causes the test to fail as 
> follows:
>
> $ make -C test calc-tests SELECTOR='\"test-calc-23889$$\"'
> [...]
> Test test-calc-23889 condition:
>    (wrong-type-argument numberp
>                         (bigpos 8818 2198 5253))
>   FAILED  1/1  test-calc-23889
Thank you.
I pushed a fix which skip the test if the Lisp integer isn't big enough.
It must be OK now.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-26  2:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170518054755.876.89150@vcs0.savannah.gnu.org>
     [not found] ` <20170518054757.B498920AC9@vcs0.savannah.gnu.org>
2017-05-25 21:42   ` [Emacs-diffs] master c48e539 2/2: Use the expression angle units while simplifying it Ken Brown
2017-05-26  2:03     ` Tino Calancha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).