Programming :: Do Not Miss Any Cases While Making The Test Case Doc?
Jul 28, 2010
Few months back I learnt a *few* concepts about bits/bytes and started writing a program for bit packing in C++. Now that program has grown upto 600 lines and I am still working on it. Yesterday I realized I missed some special cases due to which the program was malfunctioning. Now I have modified the program and it is working properly but I think If I would have designed all the possible test cases before writing the code, I would have finished the program long ago.
I. What is proper way to design the test cases before coding?
II. How should I make sure that I do not miss any cases while making the test case doc. ?
III. Does writing test cases prior to coding solve messy code issues or should I consider something else ?
View 8 Replies
ADVERTISEMENT
Jan 30, 2010
I was windering, if you are writing a C program, I don't think you are supposed to commit the .o files and executables. How can you test your program without making a copy outside the git working dir?
View 3 Replies
View Related
Jun 23, 2010
An arbitrary matrix can be solved using Gauss-Jordan elimination with O(n^3) complexity. A tridiagonal matrix (i.e. a special type of matrix) can be solved using Gauss-Jordan with O(n) complexity. That is, a for an arbitrary matrix, Gauss-Jordan is a cumbersome algorithm, but for a tridiagonal matrix, the algorithm can be expressed as a loop and a simple formula. If I were writing, for example, a compiler or some optimization program, is there a way to test the problem to see if it has become less complex, so I can express the algorithm more simply?
View 2 Replies
View Related
Oct 6, 2010
I've written a simple perl code to learn switches in perl.My code is pasted below,
#!/usr/bin/perl
$opt = 1;
switch($opt) {
[code]...
View 3 Replies
View Related
Oct 28, 2010
Kernel 2.6, Slackware 12.0
mkisofs 2.01
I do 'mkisofs -iso-level 1 -o image John Smith.txt'. Only an example. When I mount image, ls outputs john_smi.txt. So it has shorten to 8.3 and translated ' ' into '_'. This is in accordance with the manual, although it doesn't say the conversion will be done.
Quote:
-iso-level level
.........................
With all iso9660 levels from 1..3, all filenames are restricted to upper case letters, numbers and the underscore (_).
...........................
However, as it did not reject the file name, it should have converted it to all upper case, it seems to me. And -iso-level 2|3 does the same thing.
Code:
root@darkstar:~# mkisofs -iso-level 1 -o image John Smith.txt
Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 0
[code]....
View 5 Replies
View Related
May 14, 2010
As you know that GNU-C provides qsort() function in <cstdlib> in this prototype
Code:
You may know about Selection Sort Algorithm already, I want to write a function to perform Selection Sort but it can apply generally for many type: int, long, float, double... like qsort() above.
View 14 Replies
View Related
Jul 9, 2011
GNU assembler 2.17 (invoked as 'as').
Is there a way of setting no case sensitivity in as?
View 3 Replies
View Related
Jun 9, 2010
the following works and BASH doesn't complain, but VIM highlights the closing square bracket is if it sees a syntax error. Is there a better way to express regex in a case statement or is this an issue with VIM?
Code:
#!/bin/bash
case $1 in
[code]...
View 3 Replies
View Related
Feb 27, 2011
I'm having this problem with this piece of code, and i don't really get what the problem is, maybe is because i am already too sleepy to concentrate enough but maybe
switch(plazo){
case 1:
plazo = 12;
[code]....
View 3 Replies
View Related
Aug 7, 2010
I want to display 4 options using the case command and refresh the screen when options 1 and 2 are chosen (no changes to the options and you get asked again to chose option), but give a message for option 3 and exit on option 4. I set this up with the script below, but choosing option 1 works and choosing option 2 exits the script.
Code:
#!/bin/bash
#testing options
Option="0"
[code]....
View 7 Replies
View Related
Jan 23, 2010
Does it possible to escape * in the case statement
Code:
View 2 Replies
View Related
Jul 11, 2010
I am working with a third party that use windows to compile. When we port that code I am running into a lot of case issues where the includes are not case sensitive. Is there any option in GCC to make it case insensitive. I know its a long shot, as I have done reading and does not seem so.
View 1 Replies
View Related
Nov 28, 2010
I have a file like below. For all the lines (except for the ones listed as 'Unknown Owner' and N/A') I would like to change to lower case and concatenate the first and last names.Before:
Code:
aaa.bbb.ccc.ddd,Unknown Owner
ddd.eee.fff.ggg,N/A
hhh.iii.jjj.kkk,John Doe
aaa.bbb.ccc.ddd,Mary Jane
[Code]...
View 4 Replies
View Related
Aug 7, 2010
I've started dabbling with the case statement in order to pass some option's arguments into variables. I do not think I am doing this right.
Code:
usage() {
echo "Usage: $0 [-z|--snooze] [-c|--channel] [-p|--playlist]
[-m|--message] [-v|--mpcvolume]"
[code]....
As you can see, I want to pass arguments depending on the option(s) chosen by the user; ie. --snooze, or --channel. By default, if no options are chosen, I'll display a usage message; though in the future I'll provide some sane defaults. I'd like to create a case statement to handle passing arguments to any number of options; something like:
Code:
wakethehellup.sh --snooze 20 --message 'wake up!'
and for the other arguments, it would have a default set. The case statement I provided fails with a syntax error "syntax error near unexpected token `$2'" near the '--snooze' in the statement, so I take it you can't pass a parameter in this way; but I'm confused as to how I'm supposed to pass different parameters to different options without the options being confused as parameters.
View 2 Replies
View Related
Jan 19, 2010
I am trying to do a search for the certain books, and I am trying to make it case insensitive. what I have come up with so far is this :
Code:
Database.txt
RETARDED MONKEY:RACHEAL ABRAHAML:30:30:20
GOLD:FATIN:23.20:12:3
StUPiD:JERLYN:20:40:3
Code:
echo -n "Title: "
read Title
echo -n "Author:"
read Author
echo ""
valuecheck='grep -i "$Title" Database.txt | grep -i "$Author" | awk -F":" '{ print $1}''
echo $valuecheck
if [ $Title = $valuecheck ] ; then
echo "HOHOHO"
else
echo "too bad"
fi
The issue which I am having is that, when it does the search for the correct row to be inputted into valuecheck, it will input the value as written in the database, which is in Uppercase. For this case, if I type in stupid for $Title and jerlyn for $Author, it searches the correct row, but the awk will print "STUPID" into the variable as that is what is written in the database. So how can I make my if statement case insensitive? Currently it reads like this:
Code:
if [ $Title = $valuecheck ] ; then
which means
if [stupid = StUPiD ] ; then
How can I make the if statement it case insensitive to allow it to display "HOHOHO"
View 5 Replies
View Related
Feb 3, 2010
How do i make my strings case-insensitive while comparing them with an if statement?
View 2 Replies
View Related
Jan 6, 2011
I wasn't sure where to put this so if I need to move it just let me know.I have a strange problem that I cannot figure out. When I use gdb to debug our rpm-installed program, it says (no debugging symbols found) when it loads. Thing is, when I use nm on the program it can print the symbols, and even stranger is if I use gdb on the program before it is packed up by rpmbuild it loads the debug symbols just fine.Our program is built via the standard make using:GS=-g -Wall-pedantic and as I mentioned I can debug the resulting program. After the build, I package it up using:
cmd="rpmbuild -v -bb ptsnmp.spec --define "ver ${cmvc_release}" --define "rel ${cmvc_level}" --define "_topdir $rpmdir""When this package is installed via rpm, the binary on the machine shows all the debug info via nm, file shows it is not stripped:pt_snmp: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not strippedyet when I try to debug it I get the no debugging symbols found.This is really taxing my brain and I am sure I am just missing something
View 4 Replies
View Related
Mar 12, 2010
I tried to add my wife , and when I put in a password for her, this error comes up."Please set a valid user name consisting of a lower case letter followed by lower case letters and numbers." I did all that and I still can't set a password for her.
View 3 Replies
View Related
Oct 25, 2010
I am having a weird problem where if I don't touch the mouse or keyboard after logging on, the power manager settings are being ignored. I disabled turning off the display and screen saver from the Gnome utilities, but after about 20 minutes my screen blanks and my wireless network connection gets disconnected. This is on an HTPC, so I'm usually not near the mouse or keyboard, and unfortunately button presses from the remote control don't count. Media players like MPlayer will prevent the screen from blanking, but if I'm listening to music (where the music is served over the network from another computer), this means that the screen will go blank and the music playback will freeze as the network connection is lost. If I touch the keyboard just after booting it doesn't blank the screen or disconnect my wireless, but when I forget it's very disruptive.
I am running Debian Testing (Squeeze) with a Gnome desktop environment. I'm using gdm3 to log in, but I have it set up to automatically log me on. (I use gdm on my desktop, also with Squeeze, with it configured to show login screen instead of automatically logging me on and it still displays that behavior) I have attempted the following to resolve this issue to no avail:
Disable DPMS for my screen and monitor in /etc/X11/Xorg.conf Set all the timeouts for blanking, power down, etc. to 0 in /etc/X11/Xorg.conf Flat out disabling the DPMS extension. (so it's still blanking, even if it's not actually turning on power saving mode) Putting "xset s off" in ~/.xinitrc Disabling powersave with setterm in ~/.xinitrc
Removing gnome-screensaver and gnome-power-manager from the startup items.
Edit: Actually, the wireless issue seems to not be related. It disconnected again, and after some searching with the error message I saw in dmesg, it looks like others have been having the same issue. It seems to have been coincidental that it was acting up when I was testing the screen blanking issue, and hasn't given me as much trouble lately, so it seemed like it was correlated.
View 3 Replies
View Related
Jun 6, 2011
I'm a bit stuck with IF statement. There is the code:
#!/bin/bash
# Variables
VAR1=test
VAR2="echo $VAR1"
# Case 1
echo Case 1
if [ test == test ]; then
echo "equal"
else
echo "not equal"
fi;
echo ""
# Case 2
echo Case 2
if [ "VAR1" == test ]; then
echo "equal"
else
echo "not equal"
fi;
echo ""
# Case 3
echo Case 3
if [ "VAR2" == test ]; then
echo "equal"
else
echo "not equal"
fi;
echo ""
When executed, why case "2" and "3" differs from case "1"? Where am I wrong and how to solve this trouble? (my aim is to get "equal" from all cases).
View 2 Replies
View Related
Apr 25, 2011
I've just upgraded ubuntu and i noticed that the ubuntu logo has been replaced with the text "Ubuntu 10.10". When i boot ubuntu i get a black screen for 10-15 seconds and then the text and the five dots. Before the desktop is loaded the computer shows some other text like those in verbose mode.
View 4 Replies
View Related
May 4, 2010
I want to copy files from an incoming directory, but don't want to copy a file if it hasn't finished being written. I thought of using fuser, but it doesn't seem to be very reliable. I vi'd a file in one window and then ran fuser against the file name and got nothing back. I'm just writing a simple bourne script on RHEL.
View 5 Replies
View Related
Jan 6, 2011
Most of the time my wireless works very well, connecting lightning-fast on boot with AC power. However here are two problems that I have noticed to-date: 1. Wireless will not connect if I boot on battery power. It won't connect even if I plug in the AC cable and do a reboot. Only solution is to reset the router (unplug power cable, wait, plug power cable). 2. Wireless will not connect after a Suspend, whether battery power or AC. Again, only solution is to reset the router. Another computer, running Windows XP, do not have connection problems (yes, wireless). It is quite strange, maybe some power management settings are interfering with networking? I have both laptop-mode-tools and pm-utils (re-rolled) installed.
View 2 Replies
View Related
Aug 22, 2011
However, I miss the keyboard shortcut options under kde. For instance, I would like to open various software (Chromium, Gimp, etc) with a simple F2, F3 etc. I am assuming I will need to load a start-up application/script to do this.
View 7 Replies
View Related
Apr 12, 2010
We have a problem with tcp link.
Os version: linux 2.6.9
Client will connect 2 tcp links to server.
One link is ok but another can't.
From tcpdump, we see:
1. client SYN-----> server
2. server SYN/ACK---> client
3. client ACK ----> server
4. client data ----> server
5. client retransmit data some times ----> server
6. server SYN/ACK ----> client (weird, it look like server miss the step 3)
View 2 Replies
View Related
Aug 29, 2011
I tried to install gcc on my box, but I got "Missing Dependency" in the end.
# yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
dcsrd
[Code]....
View 2 Replies
View Related
Mar 9, 2010
I wrote a test program to get the CPU utilisation. I hope to extend it to take cpu utilisation on multi core machines. Hear I used the equation for taking cpu utilisation given at [url] of JmSchanck post. But when I match the output of my program against 'top' and 'system monitor' output it seems quite high. Sometimes cpu utilisation goes more than 100%.
So the given equation in that url is correct? can anyone give me the equation to take CPU utilisation?
Code:
View 3 Replies
View Related
Apr 7, 2009
I am trying to use a shell script to find a string in a file and do something when found. code...
What should happen is pppd will start in a different process and stream it's output to pppdout. pppdout should be created in the current folder. Then the script should periodically check the pppdout file for the string Script (which eventually will appear, some seconds later) and when found exit the script. Ultimately the script will do something useful when the text is found. However, the output from the program is a repeating: 'scriptname.sh: 12: FOUND: not found'
Where scriptname.sh would be the name of your script and 12 refers to the line with 'done'.
Why does grep not find the text, or at least why deos my script not check the grep output correctly?
View 10 Replies
View Related
Mar 20, 2011
I wanted to make some modifications to a Kate plugin, so I cloned the git repository, started doing a few changes, and it compiled. The problem is that when I run it, it uses the version of the plugin installed in the system, not the one compiled with Kate.
View 1 Replies
View Related
Mar 20, 2011
I've been reviewing some source code recently which contains many conditional compilation statements, and I found it hard to understand the code not knowing whether some macro is defined or not. Is there any way to test whether a macro is defined?
View 2 Replies
View Related