squid-
cache.org
Optimising Web Delivery
Docs
Download
Donate
Support
About
Contact
Shop
Blog
test-suite
mem_node_test.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3
*
4
* Squid software is distributed under GPLv2+ license and includes
5
* contributions from numerous individuals and organizations.
6
* Please see the COPYING and CONTRIBUTORS files for details.
7
*/
8
9
/* DEBUG: section 19 Store Memory Primitives */
10
11
#include "
squid.h
"
12
#include "
mem_node.h
"
13
14
#include <iostream>
15
16
int
17
main
(
int
,
char
*[])
18
{
19
mem_node
*aNode =
new
mem_node
(0);
20
assert
(aNode);
21
/* This will fail if MemPools are disabled. A knock on effect is that
22
* the store will never trim memory
23
*/
24
assert
(
mem_node::InUseCount
() == 1);
25
assert
(
SM_PAGE_SIZE
> 50);
26
aNode->
nodeBuffer
.
length
= 45;
27
assert
(aNode->
start
() == 0);
28
assert
(aNode->
end
() == 45);
29
assert
(aNode->
dataRange
().size() == 45);
30
aNode->
nodeBuffer
.
offset
= 50;
31
assert
(aNode->
start
() == 50);
32
assert
(aNode->
end
() == 95);
33
assert
(aNode->
dataRange
().size() == 45);
34
assert
(!aNode->
contains
(49));
35
assert
(aNode->
contains
(50));
36
assert
(aNode->
contains
(75));
37
assert
(!aNode->
contains
(95));
38
assert
(aNode->
contains
(94));
39
assert
(!aNode->
canAccept
(50));
40
assert
(aNode->
canAccept
(95));
41
assert
(!aNode->
canAccept
(94));
42
aNode->
nodeBuffer
.
length
=
SM_PAGE_SIZE
- 1;
43
assert
(aNode->
canAccept
(50 +
SM_PAGE_SIZE
- 1));
44
assert
(!aNode->
canAccept
(50 +
SM_PAGE_SIZE
));
45
assert
(
mem_node
(0) <
mem_node
(2));
46
assert
(!(
mem_node
(0) <
mem_node
(0)));
47
assert
(!(
mem_node
(2) <
mem_node
(0)));
48
delete
aNode;
49
assert
(
mem_node::InUseCount
() == 0);
50
return
EXIT_SUCCESS;
51
}
52
assert
#define assert(EX)
Definition:
assert.h:17
StoreIOBuffer::offset
int64_t offset
Definition:
StoreIOBuffer.h:58
StoreIOBuffer::length
size_t length
Definition:
StoreIOBuffer.h:57
mem_node
Definition:
mem_node.h:18
mem_node::nodeBuffer
StoreIOBuffer nodeBuffer
Definition:
mem_node.h:35
mem_node::dataRange
Range< int64_t > dataRange() const
Definition:
mem_node.cc:80
mem_node::canAccept
bool canAccept(int64_t const &location) const
Definition:
mem_node.cc:102
mem_node::contains
bool contains(int64_t const &location) const
Definition:
mem_node.cc:92
mem_node::InUseCount
static size_t InUseCount()
Definition:
mem_node.cc:55
mem_node::end
int64_t end() const
Definition:
mem_node.cc:74
mem_node::start
int64_t start() const
Definition:
mem_node.cc:67
SM_PAGE_SIZE
#define SM_PAGE_SIZE
Definition:
defines.h:65
mem_node.h
main
int main(int, char *[])
Definition:
mem_node_test.cc:17
squid.h
Introduction
About Squid
Why Squid?
Squid Developers
How to Donate
How to Help Out
Getting Squid
Squid Source Packages
Squid Deployment Case-Studies
Squid Software Foundation
Documentation
Quick Setup
Configuration:
Reference
Examples
FAQ
and
Wiki
Guide Books:
Beginners
Definitive
Non-English
More...
Support
Security Advisories
Bugzilla Database
Mailing lists
Contacting us
Commercial services
Project Sponsors
Squid-based products
Miscellaneous
Developer Resources
Related Writings
Related Software:
Authenticators
Ecap
Icap
Ident
Log Analysis
Monitor
Proxies
Redirectors
General
Squid Artwork
Web Site Translations
Japanese
Mirrors
Website:
gr
il
pl
...
full list
FTP Package Archive