Compare commits

..

No commits in common. "rawhide" and "F-11-split" have entirely different histories.

16 changed files with 115 additions and 326 deletions

1
.cvsignore Normal file
View file

@ -0,0 +1 @@
bc-1.06.tar.gz

View file

@ -1 +0,0 @@
1

8
.gitignore vendored
View file

@ -1,8 +0,0 @@
bc-1.06.95.tar.bz2
/bc-1.07.tar.gz
/bc-1.07.1.tar.gz
/bc-1.08.1.tar.gz
/bc-1.08.1.tar.xz
/bc-1.08.1.tar.xz.sig
/bc-1.08.2.tar.gz
/bc-1.08.2.tar.gz.sig

21
Makefile Normal file
View file

@ -0,0 +1,21 @@
# Makefile for source rpm: bc
# $Id: Makefile,v 1.1 2004/09/09 03:26:42 cvsdist Exp $
NAME := bc
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View file

@ -0,0 +1,15 @@
--- bc-1.06/doc/bc.info.info_exp_bessel 2003-08-12 14:57:45.000000000 +0200
+++ bc-1.06/doc/bc.info 2003-08-12 14:57:51.000000000 +0200
@@ -664,10 +664,10 @@
`l (X)'
The natural logarithm of X.
-`E (X)'
+`e (X)'
The exponential function of raising E to the value X.
-`J (N,X)'
+`j (N,X)'
The bessel function of integer order N of X.


10
bc-1.06-readline42.patch Normal file
View file

@ -0,0 +1,10 @@
--- bc-1.06/bc/scan.l.sux Fri May 11 14:27:20 2001
+++ bc-1.06/bc/scan.l Fri May 11 14:27:32 2001
@@ -143,7 +143,6 @@
/* Definitions for readline access. */
extern FILE *rl_instream;
-_PROTOTYPE(char *readline, (char *));
/* rl_input puts upto MAX characters into BUF with the number put in
BUF placed in *RESULT. If the yy input file is the same as

14
bc-1.06-s390.patch Normal file
View file

@ -0,0 +1,14 @@
--- bc-1.06/bc/load.c.s390 Wed Sep 13 20:22:38 2000
+++ bc-1.06/bc/load.c Wed Sep 5 16:10:18 2001
@@ -156,7 +156,10 @@
long label_no;
long vaf_name; /* variable, array or function number. */
long func;
- program_counter save_adr;
+ /* Make save_adr static. Otherwise the whole address save stuff doesn't make
+ any sense at all and break e.g. on S390.
+ 09/05/01 Phil Knirsch <pknirsch@redhat.de> */
+ static program_counter save_adr;
/* Initialize. */
str = code;

10
bc-1.06-string.patch Normal file
View file

@ -0,0 +1,10 @@
--- bc-1.06/lib/number.c.string 2007-07-26 15:01:34.000000000 +0200
+++ bc-1.06/lib/number.c 2007-07-26 15:01:41.000000000 +0200
@@ -34,6 +34,7 @@
#include <number.h>
#include <assert.h>
#include <stdlib.h>
+#include <string.h>
#include <ctype.h>/* Prototypes needed for external utility routines. */
#define bc_rt_warn rt_warn

View file

@ -1,24 +0,0 @@
diff -up wrk/doc/bc.1.wrk wrk/doc/bc.1
--- wrk/doc/bc.1.wrk 2013-10-02 13:36:52.066295450 +0200
+++ wrk/doc/bc.1 2013-10-02 13:35:22.738553712 +0200
@@ -174,6 +174,8 @@ The result of the expression is the sum
The result of the expression is the difference of the two expressions.
.IP "expr * expr"
The result of the expression is the product of the two expressions.
+If a and b are the scales of the two expressions, then the scale of the result is:
+min(a+b,max(scale,a,b))
.IP "expr / expr"
The result of the expression is the quotient of the two expressions.
The scale of the result is the value of the variable \fBscale\fR.
diff -up wrk/doc/bc.texi.wrk wrk/doc/bc.texi
--- wrk/doc/bc.texi.wrk 2013-10-02 13:17:01.743765518 +0200
+++ wrk/doc/bc.texi 2013-10-02 13:21:04.479870656 +0200
@@ -290,6 +290,8 @@ The result of the expression is the diff
@item expr * expr
The result of the expression is the product of the two expressions.
+If a and b are the scales of the two expressions, then the scale of the result is:
+min(a+b,max(@var{scale},a,b))
@item expr / expr
The result of the expression is the quotient of the two expressions.

View file

@ -1,14 +0,0 @@
diff -Naur bc-1.07.1/bc/scan.l bc-1.07.1-new/bc/scan.l
--- bc-1.07.1/bc/scan.l 2017-04-07 22:20:02.000000000 +0000
+++ bc-1.07.1-new/bc/scan.l 2021-08-14 12:12:33.860991777 +0000
@@ -170,6 +170,10 @@
if (rl_len != 1)
add_history (rl_line);
rl_line[rl_len-1] = '\n';
+ /* readline doesn't echo empty lines without a prompt,
+ so do so here. */
+ if (rl_len == 1)
+ putchar ('\n');
fflush (stdout);
}

231
bc.spec
View file

@ -1,24 +1,20 @@
Summary: GNU's bc (a numeric processing language) and dc (a calculator) Summary: GNU's bc (a numeric processing language) and dc (a calculator)
Name: bc Name: bc
Version: 1.08.2 Version: 1.06
Release: 2%{?dist} Release: 34%{?dist}
License: GPL-3.0-or-later License: GPLv2+
URL: https://www.gnu.org/software/bc/ URL: http://www.gnu.org/software/bc/
Source0: https://ftp.gnu.org/gnu/bc/bc-%{version}.tar.gz Group: Applications/Engineering
Source1: https://ftp.gnu.org/gnu/bc/bc-%{version}.tar.gz.sig Source: ftp://ftp.gnu.org/gnu/bc/bc-%{version}.tar.gz
Source2: kevin_pizzini.asc Patch1: bc-1.06-readline42.patch
Patch1: bc-1.06-dc_ibase.patch Patch2: bc-1.06-s390.patch
Patch2: bc-1.06.95-doc.patch Patch3: bc-1.06-info_exp_bessel.patch
Patch3: bc-1.07.1-readline-echo-empty.diff Patch5: bc-1.06-string.patch
BuildRequires: bison Patch6: bc-1.06-dc_ibase.patch
BuildRequires: ed Requires(post): /sbin/install-info
BuildRequires: flex Requires(preun): /sbin/install-info
BuildRequires: gcc Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: make BuildRequires: readline-devel, flex
BuildRequires: readline-devel
BuildRequires: texinfo
# for gpg verification
BuildRequires: gnupg2
%description %description
The bc package includes bc and dc. Bc is an arbitrary precision The bc package includes bc and dc. Bc is an arbitrary precision
@ -30,186 +26,45 @@ Install the bc package if you need its number handling capabilities or
if you would like to use its text mode calculator. if you would like to use its text mode calculator.
%prep %prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %setup -q
%autosetup -p1 %patch1 -p1 -b .rl22
%patch2 -p1 -b .s390
%patch3 -p1 -b .info_exp_bessel
%patch5 -p1 -b .string
%patch6 -p1 -b .dc_ibase
%build %build
%configure --with-readline %configure --with-readline
%make_build make %{?_smp_mflags}
%install %install
%make_install rm -rf $RPM_BUILD_ROOT
rm -f %{buildroot}/%{_infodir}/dir
make install DESTDIR=$RPM_BUILD_ROOT
rm -f $RPM_BUILD_ROOT/%{_infodir}/dir
%clean
rm -rf $RPM_BUILD_ROOT
%post
/sbin/install-info %{_infodir}/bc.info %{_infodir}/dir --entry="* bc: (bc). The GNU calculator language." || :
/sbin/install-info %{_infodir}/dc.info %{_infodir}/dir --entry="* dc: (dc). The GNU RPN calculator."|| :
%preun
if [ $1 = 0 ]; then
/sbin/install-info --delete %{_infodir}/bc.info %{_infodir}/dir --entry="* bc: (bc). The GNU calculator language." || :
/sbin/install-info --delete %{_infodir}/dc.info %{_infodir}/dir --entry="* dc: (dc). The GNU RPN calculator." || :
fi
%files %files
%license COPYING COPYING.LIB %defattr(-,root,root,-)
%doc FAQ AUTHORS NEWS README Examples/ %doc COPYING COPYING.LIB FAQ AUTHORS NEWS README Examples/
%{_bindir}/dc %{_bindir}/dc
%{_bindir}/bc %{_bindir}/bc
%{_mandir}/man1/bc.1* %{_mandir}/*/*
%{_mandir}/man1/dc.1* %{_infodir}/*
%{_infodir}/bc.info*
%{_infodir}/dc.info*
%changelog %changelog
* Wed Jul 23 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.08.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Thu Jun 26 2025 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 1.08.2-1
- Update to 1.08.2 - rhbz#2368486
* Wed Mar 05 2025 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 1.08.1-3
- Verify gpg signature
- Change to https links
- Misc changes
* Thu Jan 16 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.08.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Mon Jan 06 2025 Fedora Release Monitoring <release-monitoring@fedoraproject.org> - 1.08.1-1
- Update to 1.08.1 (#2335123)
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Tue Jan 23 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Sun Jun 25 2023 Sérgio Basto <sergio@serjux.com> - 1.07.1-18
- Migrate to SPDX license format
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Sat Aug 14 2021 Pádraig Brady <P@draigBrady.com> - 1.07.1-14
- Echo empty lines, useful for delimiting work
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.07.1-8
- Rebuild for readline 8.0
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Sep 13 2017 Vasiliy N. Glazov <vascom2@gmail.com> - 1.07.1-4
- Cleanup spec
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.07.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon May 15 2017 Kevin Fenzi <kevin@scrye.com> - 1.07.1-1https://bugs.archlinux.org/task/53546
- Update to 1.07.1
- Fixes a bug that breaks kernel builds ( https://bugs.archlinux.org/task/53546 )
* Mon May 15 2017 Ondrej Vasik <ovasik@redhat.com> - 1.07-2
- build seems to be racy now, removing parallel build for now
- add build dep on "ed"
* Wed May 10 2017 Ondrej Vasik <ovasik@redhat.com> - 1.07-1
- new upstream version 1.07, dropped patches already appllied
in usptream version
* Wed Feb 01 2017 Stephen Gallagher <sgallagh@redhat.com> - 1.06.95-18
- Install COPYING[.*] using the %%license macro
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 1.06.95-17
- Rebuild for readline 7.x
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.06.95-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat Feb 21 2015 Till Maas <opensource@till.name> - 1.06.95-14
- Rebuilt for Fedora 23 Change
https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code
* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Oct 02 2013 Frantisek Kluknavsky <fkluknav@redhat.com> - 1.06.95-11
- man and info patched - clarified scale after multiplication
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Tue Oct 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-8
- Minor spec cleanup
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Oct 26 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-5
- Rebuilt for glibc bug#747377
* Thu Sep 08 2011 Ondrej Vasik <ovasik@redhat.com> 1.06.95-4
- do not mask SIGINT in dc when reading from stdin (#697340)
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06.95-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Dec 22 2010 Ondrej Vasik <ovasik@redhat.com> 1.06.95-2
- fix possible segfault in arrays handling(debbug #586969)
- initialize f_void to work with math lib again(#664080)
* Thu Sep 24 2009 Ondrej Vasik <ovasik@redhat.com> 1.06.95-1
- update to upstream alpha 1.06.95 (in use in Gentoo, Slackware
for quite a long time, marked stable there)
- removed already applied patches, fix small memory leak
(gentoo patch)
- add missing BR for bison and texinfo
* Thu Aug 20 2009 Zdenek Prikryl <zprikryl@redhat.com> 1.06-36
- Don't complain if installing with --excludedocs (#515934)
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06-35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06-34 * Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.06-34
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

View file

@ -1,30 +0,0 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBEum60cBCADIZ/am0d96/2Is86VRUkNi4DReLYDzQqpuI1cCtCHKbBel6uYL
ERsTJUxgqEtYAzjQOaOOr8k7X/U8NzmmjAk/GR/coHFbGLVUI3O/TWZZ4u3bZLpC
4lhe303PZZDHMGGcUEmzhU9LDxeCYF2LfQQYWQNmc674VgOt+fcJJkty3tjWHag0
YWOPvugOg5SfqDtGPfnmoeSbdKmVgbmXLX5ab68jIRHfcQNlKgfQbkLN7CYi7ou7
f8aNIO/DQ1mFzzNc6fuP6i5zznL4FcKTzvx1z6+gtjUXWmqWuVw6qqiND7V1tjJd
b0cjl4BNoXPk3btKfYwHd9I9tTfilmWm5KNtABEBAAG0GUtlbiBQaXp6aW5pIDxr
ZW5AZ251Lm9yZz6JAVUEEwEKAD8CGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheA
FiEEMltU5GU/k1olzzK9oYYnjUJqOOkFAmclQjUFCSEh8W4ACgkQoYYnjUJqOOmj
vgf/QRqbDPdfm3+JcEQBZKjBby0syw70FrxL8oJpthTapN7vljyL1/QmrFukhScD
98mns1OJsbud11Qbdab5d3MGD9agQ4H7OGm48h4MAkkd7ekJR2ISxrNGw8pQiir8
Sr0+LsS+5l/W16GaGUegmNyirKv2//mb9IDBBmZ0Ui13x85fIwxe7PrjcLw5vIB9
qPr7bcCZaKrzuWygpbzUQwXtW1ipKierEk4C780QV3jJFw8wkTB6ul1Kk221oMo/
OeAOnLk5+d5tOtUMonyYSZmvkbEhFDpOF3J3qNomwmnBBUA+bn0hEsNjhmy3h4jS
SRRIuqRrMFF1GiFNuHa67uBI0bkBDQRLputHAQgAtCX015BdwVGX9IaO1Iv2FBkt
JSg4A/GV+0iZXVqafi5pe/oLQY7gXQUV/AuTqjj7168sb9s8ZJjzrE0CsBrcUtOU
eSKBQiCL81L6eO91tKBpwuPACEyzxiW5Bfh/dn3jiZikXBi9u7NSsLaDDj4AK6W7
6/fWz9984elxeIqZSiRuae0xTs+kaEw49ha8wrv6sE4H9CbWoz4276raGQmBJLky
NQlCZMxq6Z/a6NXTNiNNrVMueCCQmbW6iu8fV8W1IRMBnbWZjTcBBZztzW5T6mOE
3weuvYkuwy6yNcgrafG2WeW+wrYzQ38yYIH7o27pgQKySZHjZxaeoqRysW42gwAR
AQABiQE8BBgBCgAmAhsMFiEEMltU5GU/k1olzzK9oYYnjUJqOOkFAmclQkMFCSEh
8XwACgkQoYYnjUJqOOk55wf/W3p31v5zZtRyalRohfxUn9rrbucye38W+LzZGGoz
BU4CCcZhwtumkFgd3bB3t50e26VDBB3D3cVPyLDLU182eibKbgv4/6bjk09l1PRl
UhTHpWTqiz+lkmMEMsSFXWJjXssmAo5XOL4OxX/bgHUK5NgvaRg7WL1CVuLAL91s
VTasLP1XoOpZ85ec5YmzNciCU41XfGSIrkG+PbE7MJmjlUT0w4/Q59/5CiIv/XoM
UAiiIDozgvzDinVUBP8+Kl5QexEe3E3dHSNPRc4xlPsx5KTOCWJHEe00XgZgMuTZ
bzVD5uvJm95WssY37wZ2bt58iufB9sBsw2NFPr3eQIo12A==
=L3fP
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -1,5 +0,0 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

View file

@ -1,2 +1 @@
SHA512 (bc-1.08.2.tar.gz) = 0876a4c5bfc23da79479519c6a8e03ac9f59ae54077eb71ffdcc6ddaccb76c4b7595b088e89e6ad82d833c072eeff5b378178084276584813c00eedace4c6f8c d44b5dddebd8a7a7309aea6c36fda117 bc-1.06.tar.gz
SHA512 (bc-1.08.2.tar.gz.sig) = 5987363ae617b46136d5fec45e302045d55ec43db1005d175ff78d4c9a8450a7a95c4ebce22a1f810c64f21a7a6f5eee764bfe84aa084cfe439c2f04775f4939

View file

@ -1,9 +0,0 @@
summary: Basic sanity test
component:
- bc
test: python3 ./runtests.py -v
framework: shell
recommend:
- bc
- python3
duration: 1m

View file

@ -1,45 +0,0 @@
import unittest
import os
import subprocess
def call_command(command_to_call):
result = subprocess.check_output(command_to_call, shell=True)
return result[:-1].decode("utf-8")
class TestBC(unittest.TestCase):
def test_divide(self):
result = call_command("echo '6.5 / 2.7' | bc")
self.assertEqual( result, '2')
def test_sum(self):
result = call_command("echo '2 + 5' | bc")
self.assertEqual( result, '7')
def test_difference(self):
result = call_command("echo '10 - 4' | bc")
self.assertEqual( result, '6')
def test_multiplying(self):
result = call_command("echo '3 * 8' | bc")
self.assertEqual( result, '24')
def test_scale(self):
result = call_command("echo 'scale = 2; 2 / 3' | bc")
self.assertEqual( result, '.66')
def test_remainder(self):
result = call_command("echo '6 % 4' | bc")
self.assertEqual( result, '2')
def test_exponent(self):
result = call_command("echo '10^2' | bc")
self.assertEqual( result, '100')
if __name__ == '__main__':
unittest.main()