1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include <gtest/gtest.h>
#include "mime.h"
class MimeTest: public ::testing::Test
{
protected:
MimeTest(){
}
~MimeTest() override{
}
void SetUp() override
{
}
void TearDown() override
{
}
};
TEST_F(MimeTest, mime_type)
{
EXPECT_EQ(Reichwein::Mime::mime_type(""), "");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.html"), "text/html");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.htm"), "text/html");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.html"), "text/html");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.php"), "text/html");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.css"), "text/css");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.txt"), "text/plain");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.js"), "application/javascript");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.json"), "application/json");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.xml"), "application/xml");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.swf"), "application/x-shockwave-flash");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.flv"), "video/x-flv");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.png"), "image/png");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.jpe"), "image/jpeg");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.jpeg"), "image/jpeg");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.jpg"), "image/jpeg");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.gif"), "image/gif");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.bmp"), "image/bmp");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.ico"), "image/vnd.microsoft.icon");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.tiff"), "image/tiff");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.tif"), "image/tiff");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.svg"), "image/svg+xml");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.svgz"), "image/svg+xml");
EXPECT_EQ(Reichwein::Mime::mime_type("a/bcd.cpp"), "application/text");
EXPECT_EQ(Reichwein::Mime::mime_type("bla.HTML"), "text/html");
}
|