Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
bdb576d6
Commit
bdb576d6
authored
Aug 05, 2009
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some tests
parent
3db9b2c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
const_char.cc
tests/const_char.cc
+26
-0
getline.cc
tests/getline.cc
+12
-0
int_unsigned.cc
tests/int_unsigned.cc
+15
-0
No files found.
tests/const_char.cc
0 → 100644
View file @
bdb576d6
#include <string.h>
// http://www.cpptalk.net/invalid-conversion-from-char-to-const-char-vt13716.html
main
(
int
argc
,
char
**
argv
)
{
char
**
t1
;
const
char
**
t2
;
const
char
**
t3
=
new
const
char
*
[
10
];
// t3 - 土佑勺 账邻猎盘攀 瘟 const char*
char
*
const
*
t4
=
new
char
*
[
10
];
// t4 - 讼斡粤卧钨 土佑勺 账邻猎盘攀 瘟 char*
const
char
*
const
*
t5
;
t1
=
argv
;
// t2 = argv; // error: invalid conversion from 'char**' to 'const char**'
t2
=
(
const
char
**
)
argv
;
t4
=
argv
;
t3
[
0
]
=
argv
[
0
];
// t4[0] = argv[0]; // error: assignment of read-only location '* t4'
t3
[
0
]
=
new
char
[
100
];
//strcpy(t3[0],"text"); // error: invalid conversion from 'const char*' to 'char*'
strcpy
(
t4
[
0
],
"text"
);
// error: invalid conversion from 'const char*' to 'char*'
t3
[
0
]
=
"test"
;
// t4[0] = "test"; // error: assignment of read-only location '* t4', warning: deprecated conversion from string constant to 'char*'
t5
=
argv
;
t5
=
t3
;
t5
=
t4
;
}
tests/getline.cc
0 → 100644
View file @
bdb576d6
#include <iostream>
#include <string>
#include <cstring>
using
namespace
std
;
int
main
()
{
string
str
;
getline
(
cin
,
str
);
cout
<<
"size of str="
<<
str
.
size
()
<<
", strlen="
<<
strlen
(
str
.
c_str
())
<<
endl
;
}
tests/int_unsigned.cc
0 → 100644
View file @
bdb576d6
#include <stdio.h>
int
main
()
{
int
a
=
5
;
int
b
=
-
5
;
unsigned
int
c
=
5
;
unsigned
int
d
=
-
5
;
int
*
e
=
(
int
*
)
&
d
;
if
(
a
<
b
)
printf
(
"a<b
\n
"
);
if
(
c
<
d
)
printf
(
"c<d
\n
"
);
printf
(
"%x
\n
"
,
*
e
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment