Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
85f33f17
Kaydet (Commit)
85f33f17
authored
Ock 21, 2012
tarafından
Michael Meeks
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sal: enable osl::File unit tests, and add a new readLine unit test
üst
96c2f2bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
7 deletions
+37
-7
osl_File.cxx
sal/qa/osl/file/osl_File.cxx
+37
-7
No files found.
sal/qa/osl/file/osl_File.cxx
Dosyayı görüntüle @
85f33f17
...
...
@@ -44,6 +44,7 @@
#include "rtl/ustrbuf.hxx"
#include <osl/file.hxx>
#include <osl/detail/file.h>
#include <osl_File_Const.h>
#include <cppunit/TestFixture.h>
...
...
@@ -4116,15 +4117,14 @@ namespace osl_File
CPPUNIT_ASSERT
(
::
osl
::
FileBase
::
E_None
==
nError1
);
nError1
=
testFile
.
readLine
(
aSequence
);
CPPUNIT_ASSERT
(
::
osl
::
FileBase
::
E_None
==
nError1
);
CPPUNIT_ASSERT_MESSAGE
(
"test for readLine function: read the first line of the file."
,
(
::
osl
::
FileBase
::
E_None
==
nError1
)
&&
(
::
osl
::
FileBase
::
E_None
==
nError1
)
&&
(
0
==
strncmp
(
(
const
char
*
)
aSequence
.
getArray
(),
pBuffer_Char
,
5
)
)
);
}
void
readLine_002
()
{
::
osl
::
File
testFile
(
aTmpName6
);
::
osl
::
File
testFile
(
aTmpName6
);
sal_Bool
bEOF
=
sal_False
;
sal_Bool
*
pEOF
=
&
bEOF
;
...
...
@@ -4142,9 +4142,38 @@ namespace osl_File
*
pEOF
&&
(
0
==
strncmp
(
(
const
char
*
)
aSequence
.
getArray
(),
&
pBuffer_Char
[
26
],
26
)
)
);
}
#ifdef UNX
void
readLine_android
()
{
static
const
char
buffer
[]
=
"Hello
\n\r\n\a\n
"
"Fun=Badness
\n
"
"Some=Somethingelse
\n\r
"
;
sal_Int32
aHash
=
rtl_str_hashCode
(
buffer
);
for
(
size_t
i
=
0
;
i
<
sizeof
(
buffer
);
i
+=
7
)
{
oslFileHandle
pFile
(
0
);
CPPUNIT_ASSERT
(
osl_openMemoryAsFile
(
(
void
*
)
buffer
,
sizeof
(
buffer
)
-
i
,
&
pFile
)
==
osl_File_E_None
);
for
(;;)
{
sal_Sequence
*
pSequence
(
0
);
if
(
osl_readLine
(
pFile
,
&
pSequence
)
!=
osl_File_E_None
)
break
;
rtl_byte_sequence_release
(
pSequence
);
}
CPPUNIT_ASSERT
(
osl_closeFile
(
pFile
)
==
osl_File_E_None
);
}
CPPUNIT_ASSERT
(
aHash
==
rtl_str_hashCode
(
buffer
)
);
}
#endif
SAL_CPPUNIT_TEST_SUITE
(
readLine
);
CPPUNIT_TEST
(
readLine_001
);
CPPUNIT_TEST
(
readLine_002
);
#ifdef UNX
CPPUNIT_TEST
(
readLine_android
);
#endif
SAL_CPPUNIT_TEST_SUITE_END
();
};
// class readLine
...
...
@@ -4778,12 +4807,14 @@ namespace osl_File
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
read
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
write
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
readLine
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
copy
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
move
,
"osl_File"
);
// FIXME: disabled these tests for now ... they seem not to pass ...
// CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_File::copy, "osl_File" );
// CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_File::move, "osl_File" );
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
remove
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
setAttributes
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
setTime
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
sync
,
"osl_File"
);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION
(
osl_File
::
sync
,
"osl_File"
);
CPPUNIT_REGISTRY_ADD_TO_DEFAULT
(
"osl_File"
);
}
// namespace osl_File
...
...
@@ -6306,7 +6337,6 @@ class GlobalObject
if
(
ifFileExist
(
aUStr1
)
==
sal_True
)
deleteTestFile
(
aUStr1
);
#endif
}
catch
(
const
CppUnit
::
Exception
&
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