Test a program in the same or a different programming language? [closed] - testing

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
When I started to learn about testing a program, all I learned is to
use a library or package in the same language as the tested program.
For example,
if a tested program is written in Python, its testing program is also written in Python and uses UnitTest class in the python
standard library
if a tested program is written in C++, its testing program is also written in C++ and uses some test library in C++.
I just saw a project where the tested program is written in C++, and
the testing program is written in Python. Instead of making the
Python testing program to call the C++ tested source code, the
Python testing program loads and executes the executable compiled
from the C++ tested program.
General in software engineering, for a project, how is it decided to choose the same or a different programming language to test a program?
Thanks.

I assume that you refer to unit tests, at least in the widest sense.
Normally you will use the same language for testing, just for the sake of simplicity. Using a different language just produces communication overhead between the tests and the tested code.
The only case where using a different language could make sense is when the language of your tested code is especially cumbersome (think Assembler or COBOL) or if you are not familiar with it. But the latter case actually does not count because unit tests and the tested code are normally implemented by the same developers.

Related

What is exactly Smalltalk language used for? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
What is exactly Smalltalk used for? Creating websites? Trying to understand what can be built using this language.
Also,what are the tools that are used to code in Smalltalk? I google and see Pharo as one such tool.
What is exactly small talk used for ?
Everything.
Creating websites ?
Yes.
Trying to understand what can be built using this language.
Everything. Smalltalk is Turing-complete and "Tetris-complete". It can be used for anything and everything any other language can be used for.
Things that have been built in Smalltalk:
Operating Systems
VMs (including Smalltalk VMs)
Compilers (including Smalltalk compilers)
Smalltalk IDEs (in fact, Smalltalk invented the concept of the IDE)
GUI Frameworks
Desktop systems (in fact, Smalltalk invented the concept of the desktop with overlapping windows as we know it today)
Embedded Systems (for example, the famous Tektronix oscilloscopes)
Office suites
CPU layout tools
Websites
Webservices
Games
Virtual Worlds
Simulations
AI
…
Also,what are the tools that are used to code in small talk ?
Smalltalk Systems are typically all-encompassing systems that provide everything, from the VM, compiler, debugger, IDE, version control, GUI, widgets, frameworks, tools, and libraries in one. In other words, you don't use "tools" to code in Smalltalk, you use Smalltalk to code in Smalltalk.

What is the definition of source code and code? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
What is the exact definition of source code and code?
printf("hi\n");
Is this a source code or a code?
int main(void)
{
printf("hi\n");
}
This is definitely a source code, right?
Source code is generally understood to mean programming reports created by a programmer with a text editor or visual programming tool and then stored in a file. The object code usually refers to the output, the compiled file, which is produced when the source code is compiled with a C compiler.
The code file contains a sequence of algorithms that can be read by a machine running on a computer CPU. The operating system or application software is usually in the form of a compiled object code.
Objectives of the source code
Beyond providing the foundation for software development, source code has other important purposes. For example, software installations can be easily customized if skilled users need access to the source code.
Meanwhile, other developers may use source code to create programs similar to other operating systems - which would be tricky without coding.
Allows programmers to access source code to contribute to their community, either by sharing code for learning codes or by recycling it into other parts.
There are various programs for generating source code. Here is an example source code for the Hello World project in C language:
/ * Hello World Program * /
#Include <stdio.h>
main ()
{
printf ("Hello World");
}

TensorFlow - Advantages to a certain language [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am researching into using TensorFlow and am trying to decide which language to write in.
I am currently using Clojure in my day job (I know you can use Java so should I check out a Clojure wrapper). I have also started to learn Haskell. As TensorFlow is very mathematically based maybe Haskell would be the best language to write it in.
I have read that TensorFlow is mainly written in C++ and so Python is the main language that people use.
Is it best to write TensorFlow in Python or does Clojure/Java or Haskell work just as well?
It depends on what your use case is.
For exploring machine learning concepts or for doing machine learning research Python is your best bet. It has the most features, documentation and user base to help with support.
Java and some other language bindings are geared more towards integrating models with existing code (into production pipelines, apps, your-other-production servers etc.) and don't have the convenience of breadth of API that Python provides (quoting from the api documentation - "The Python API is at present the most complete and the easiest to use, but other language APIs may be easier to integrate into projects and may offer some performance advantages in graph execution.")
The Haskell bindings might be interesting, but again, if you're exploring TensorFlow, you're probably better off with Python to begin with. If and when you need to integrate models into other software, you will be able to export them from Python and import/execute them in other languages.
Hope that helps.

Studying C++/CLI without prior knowledge of ANSI/ISO C++ [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I used to program in C#, and I want to study C++. Can I study C++/CLI directly before having prior knowledge of the ANSI/ISO C++?
C++/CLI is a language that allows you to write pure managed code. The compiler even has an option for that, /clr:pure. But the code it generates then is not different from the code that the C# compiler generates. There is therefore no point in using that feature, unless you are a die-hard C++ programmer that favors a C++-like syntax.
It is not equivalent to C++ and there's very little in the language that will prepare you to learn native C++. Very basic native C++ constructs like multiple inheritance, RAII and const are either not available or only approximated. Especially the new C++11 additions are not covered at all, not something you ever want to skip when you start out learning C++.
C++/CLI is targeted as an interop language, it makes it very easy to write a managed class wrapper around existing native C or C++ code. Clearly that is no use to you either if you don't yet know what these languages look like.
Only consider using native C++ if that's the language you want to learn. Learning C++/CLI will only confuse you.
You can, but why?
If you want to learn about C++, you better start programming in C++ (without /Cli).
C++/Cli adds a set of complex behavior and managed pointer types that are not really useful outside of writing wrappers between C++ and C#, and ref classes lack some of the major benefits of C++; namely, RAII (deterministic destruction), const, and templates.

Code coverage without instrumentation [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
We have an automated regression test setup for Functional tests and
are interested in measuring the test coverage/code coverage for our
project which is based on Linux.
I would like to know if there are any tools which can be used for test
coverage/code coverage measurement without instrumenting the code.
Please suggest any tool or method that can do this.
I am aware that instrumentation provides the best method to measure
the code coverage, but it would suffice for us if the tool can just
measure the functions that were executed for the test coverage
measurement.
Thanks and Regards,
Prashnk
There's only three ways to collect test coverage data:
Instrument the program, and let the instrumentation do to coverage collection
Interrupt the program (assuming native execution) on a periodic basic to determine its PC,
and map the PC to source line numbers
Run the program under an interpreter, and let the interpreter do it (or let the interpreter make calls on an special user-code event handler when certain key program events occur, such as "function entry").
It may be in fact, that an interpreter doesn't have that ability built-in, in which
case you are reduced to the first solution :-{ If you are running an interpreter, any test coverage data collection it may have built-in should be pretty well advertised in its documentation.
You can likely implement the "interrupt to get PC" method yourself, using symbol data from the link map or the object file (or maybe someone has done it already for you.) It has a serious downside: because you are sampling the PC, it is hard to verify that some function actually got executed. It may have, and you simply didn't sample the PC at the right moment. This is the reason this scheme isn't used in practical test coverage tools.